The following C++ program doesn't catch the exception:
Code:
#include <iostream>
using namespace std;
int main()
{
try
{
int i = 0;
int j = 1;
int k = j/i;
}
catch(...)
{
cout << "exception" << endl;
}
return 0;
}
After compiled and run, it gives
Floating Point Exception
rather than
exception
Signals can be used to handle this divide-by-zero exception, but will that work for all other system-level exceptions? I just want a simple method to make catch() work. Thanks.