#include <iostream>
using namespace std;
void test(int x)
{
try
{
if(x==1)
throw x;
else
if(x==0)
throw 'x';
cout<<"\n End of try block";
}
catch(char c)
{
cout<<"Caught a character\n";
}
catch(int m)
{
cout<<"Caught an integer\n";
}
cout<<"\nEnd of try catch system";
}
int main()
{
cout<<"\n Testing multiple catches";
cout<<"\nx==1";
test(1);
cout<<"\nx==0";
test(0);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: