throw , try, catch 使用
int x1 = 0, x2 = 1;
try
{
if(x1!=x2)
{
throw runtime_error("Number must be equal !");
}
}
catch(runtime_error& ex)
{
cout << ex.what() << endl;
}
throw , try, catch 使用
int x1 = 0, x2 = 1;
try
{
if(x1!=x2)
{
throw runtime_error("Number must be equal !");
}
}
catch(runtime_error& ex)
{
cout << ex.what() << endl;
}