#include <iostream>
using namespace std;
int main()
{
int x = -1;
// Some code
cout << "Before try
";
try {
cout << "Inside try
";
if (x < 0)
{
throw x;
cout << "After throw (Never executed)
";
}
}
catch (int x ) {
cout << "Exception Caught
";
}
cout << "After catch (Will be executed)
";
return 0;
}