EXCEPTION HANDLING USING C++
/*EXCEPTION HANDLING*/
PROGRAM
void main()
{
int a,b;
cout<<"\n Enter the value of a and b:";
cin>>a>>b;
int x=a-b;
try
{
if(x!=0)
{
cout<<"\n Result(a/x)="<<a/x;
}
else
{
throw(x);
}
}
catch(int i);
{
cout<<"\n Exception caught:x"<<x;
}
cout<<"\nENO";
Comments
Post a Comment