Professional Documents
Culture Documents
//Class: SE Div: C
//Roll No.: 43
//XCEPTION HANDLING
#include<iostream>
class excp
{
double no1,no2;
public:
void getdata()
{
cout<<"\nEnter the First Double Value :";cin>>no1;
cout<<"\nEnter the Second Double Value :";cin>>no2;
}
void division()
{
cout<<"\nDivision Result :"<<(no1/no2);
}
void displaydivision()
{
try
{
if(sizeof(no1)<2 || sizeof(no2)<2)
throw no1;
else
{
if(no2==0)
throw no2;
else
division();
}
catch(char x)
{
cout<<"\nException : Character Input :"<<x;
}
catch(double y)
{
cout<<"\nException : DIVIDE BY ZERO :"<<y;
}
}
};
int main()
{
excp a,b;
a.getdata();
a.displaydivision();
b.getdata();
b.displaydivision();
return 0;
OUTPUT
Enter the First Double Value :3