/*WAP WITH THE FOLLOWING: a. A function to read two double type numbers from the keyboard b. A function to calculate the division of these two numbers. c. A try block to throw an exception when a wrong type of data is entered. d. A try block to detect and throw an exceptiom if the condition "divide by zero" occurs. e. Appropriate catch block to handle the exception throw. ------------------------------------------------------------------------------------------*/ #include #include void main() { clrscr(); double x,y; cout<<"\nEnter the value of x : "; cin>>x; cout<<"\nEnter the value of y : "; cin>>y; try { throw 'x'; throw 'y'; } catch(char c) { cout<<"\nEither x or y i snot a double, process terminated...!"; } try { if(y!=0) { float r=x/y; cout<<"\nResult is : "; } else { throw y; } } catch(double) { cout<<"\n Exception caught, divide by zero arises...!"; } cout<<"\n\t Written By: Sujit Kr Nayak\n\t Roll No: ELD09006"; getch(); }