0
在開發的C面對的問題++,其中catch塊未顯示所需的錯誤信息try catch塊顯示錯誤的錯誤消息
#include<iostream>
using namespace std;
void mightGoWrong()
{
bool error1;
bool error2;
if(error1)
{
throw "Issue encountered!!";
}
}
int main(void)
{
try
{
mightGoWrong();
}
catch(int e)
{
cout << "Error Code is: "<<e<<endl;
}
cout<<"Still running"<<endl;
}
該消息得到的是:仍然Running.Need知道我在做什麼錯誤
如果聲明'bool error1 = true;'會發生什麼? –