AI题库 · GESP-C++四级题库
题目分享 #19851
执行下面C++代码,会输出( )。
int divide(int a, int b) {
if(b == 0) throw "Division by zero";
return a / b;
}
int main() {
int result = 0;
try {
result = divide(10, 0);
cout << "A";
}
catch(const char* msg) {
cout << "B";
result = -1;
}
cout << result;
return 0;
}
A
A0
B
B-1
C
A10
D
程序崩溃
AI题库 · 编程考级与信奥赛真题库
查看答案 →
复制链接后可在微信、QQ、小红书等平台粘贴分享;答案与解析在题目页。