#include
using namespace std;
void f(int test)
{
try{
if(test) throw test;
}
catch(int i) {
cout << "Caught One! Ex. #: " << i << '\n';
}
}
int main()
{
cout << "start\n";
f(1);
f(2);
f(0);
f(3);
cout << "end";
return 0;
}
start
Caught One! Ex. #: 1
Caught One! Ex. #: 2
Caught One! Ex. #: 3
end