#include <iostream>
using namespace std; //try尝试执行,抛出throw,throw之后语句不再执行
//catch处理throw的异常 void main()
{
float fl1, fl2;
cin >> fl1 >> fl2; //尝试执行,抛出类型检测
try
{
if (fl2 < 0.0000001)
{
throw ;
}
else if (fl1 < 0.000001)
{
throw ;
} float fl3 = fl1 / fl2;
cout << fl3 << endl;
}
//定义类型,检测判断是什么错误
catch (int code)
{
if (code == )
{
cout << "fl2太小" << endl;
}
else if (code == )
{
cout << "fl2太小" << endl;
}
} cin.get();
cin.get();
}
05-06 04:05