#include
using namespace std;
void f(int test)
{
try{
if(test)
throw test;
else
throw "Value is zero";
}
catch(int i) {
cout << "Caught Exception #: " << i << '\n';
}
catch(const char *str) {
cout << "Caught a string: ";
cout << str << '\n';
}
}
int main()
{
cout << "Start\n";
f(1);
f(2);
f(0);
f(3);
cout << "End";
return 0;
}
Start
Caught Exception #: 1
Caught Exception #: 2
Caught a string: Value is zero
Caught Exception #: 3
End"