#include<iostrearn> 
using namespace std; 
void subtract(int p, int q) //A function called subtract
with two arguments is defined 
{ 
cout<<"The subtract() function contains\n"; 
try //try block1
{ 
if(p==0) //This condition checks whether p is equal to zero
or not. 
//if yes throw an exception else perform subtraction 
throw p; //This statement throws an exception 
else 
cout<<"The result of subtraction is:"
<<p-q<<"\n"; 
}
catch(int) //This statement catches the exception throw it
again to the next try block 
{
cout<<"NULL value is caught\n"; 
throw;. 
}
cout<<."End of subtract()\n\n"; 
}
int main( ) 
{ 
Cout<<"\n The main() function
contains\n"; 
try 
{
subtract(5, 3); //passing integer values to subtract 
subtract(0, 2); 
}
catch(int) //This statement catches the rethrown
exception 
{
cout<<"NULL value caught inside
main()\n"; 
}
cout<<End of main() function \n"; 
return 0: 
}


 
