当我使用 Devc++ 或 Code blocks(compiler:GNU) 编译以下代码时,它没有捕获异常,程序崩溃。请问spmebody可以帮助我吗?提前致谢。
#include <iostream>
using namespace std;
int main()
{
int top = 90;
int bottom = 0;
try
{
cout << "top / 2 = " << (top/ 2) << endl;
cout << "top divided by bottom = ";
cout << (top / bottom) << endl;
cout << "top / 3 = " << (top/ 3) << endl;
}
catch(...)
{
cout << "something has gone wrong!" << endl;
}
cout << "Done." << endl;
return 0;
cout << "Hello world!" << endl;
return 0;
}