8. (A) Show the implementation of exception handling

8. (A) Show the implementation of exception handling
Show the implementation of exception handling


#include<iostream.h>
#include<conio.h>
Void main()
{
int a,b;
cout<<”enter values of a and b”;
cin>>a>>b;
int x=a-b;
try
{
If(x!=0)
{
cout<<”result(a/x)=”<<a/x<<”\n”;
}
Else
{
throw(x);
}
}
catch(int i)
{
Cout<<”exception caught:x=”<<x<<”\n”;
}
cout<<”end”;
}
8. (A) Show the implementation of exception handling 8. (A) Show the implementation of exception handling Reviewed by admin on December 23, 2019 Rating: 5

No comments:

Powered by Blogger.