try and catch problem

there is illogical results by using try and catch block

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
   #include<iostream>
using namespace std;

class Circle_computations
{

public:
	double area,circumference,radius,pi;
	
public:


 Circle_computations()
{
 }	
  Circle_computations(double radi)
{
pi = 3.14;
radius=radi;


}

double c_area()
{

area = pi*radius*radius;
return area;
 
}

double c_circumferunce()
{

circumference =2*pi*radius;
return circumference;

}

};

class Cylinder:public Circle_computations
{

protected:
	double height,volume,cyarea;

public:
Cylinder(double r, double h) :
    Circle_computations(r)
{
    height = h;
}

	
	double cy_area()
{
	cyarea=(2 * (Circle_computations::c_area()))+( c_circumferunce()* height) ;

cout<<cyarea;
}


double c_volume()
{
	volume = (Circle_computations::c_area())* height;

	return volume;
cout<<volume;
}


};


int main()

{
double r,heigh_t;
cout<<"**Please Enter The Radius First** \n";
cin>> r;
cout<<"**Please Enter The height** \n";
cin>>heigh_t;

try
{
if(r||heigh_t<=0.0)
{
throw "PLESE ENTER double NUMBERS";


}
}

catch (char* strException)
{
	cerr << "Error: " << strException << "\n";
}

Circle_computations  compute(r);
Cylinder computecylider(r,heigh_t);

cout<<"****The cylinder surface  Area   is****\n";
cout<<computecylider.cy_area();

cout<<"\n";
cout<<"****The cylinder volume   is****\n";
cout<<computecylider.c_volume();

cout<<"\n";


 
}
what exactly is the problem?
when i entered double numbers the throw statement executed i want try-catch block to check if the entered values are doubles and integers ,if there is any problem then try-catch is executed else the program executed without throwing exeption
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
    try
    {
        // if(r||heigh_t<=0.0)
        if( r <= 0.0 || heigh_t <= 0.0 )
        {
            // throw "PLESE ENTER double NUMBERS";
            throw "PLESE ENTER positive NUMBERS";

        }
    }

    //catch (char* strException)
    catch ( const char* strException )
    {
        cerr << "Error: " << strException << "\n";
        return 1 ;
    }
Topic archived. No new replies allowed.