try and catch problem

there is illogical results by using try and catch block

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114`` `````` #include 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<> 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<
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
 ``1234567891011121314151617`` `````` 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.