急!throw出错……
如下:
int main(int argc, char* argv[])
{
int a,b;
cin>>a>>b;
try
{
if(b==0)
throw b;
cout<<a/b<<endl;
}
catch (int)
{
cout<<"Error"<<endl;
}
system("pause");
return 0;
}
我在cb6控制台写了这么很简单的一段。通过求a/b来试验try,throw,catch.当输入12 4(b不等于0)能顺利运行,可是一旦当b等于0是就会出错误代码:
---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class int with message 'Exception Object Address: 0x9957E2'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
请问各位是怎么回事啊