// 抛出异常 #include using namespace std; int div(int a, int b) { if (b == 0) { throw "除数不能为0"; } return a / b; } int main() { cout << "-----aaaaa-----" << endl; int ret = div(20, 0); cout << ret << endl; return 0; }