题库首页 › GESP等级认证(C++) › 题目 21062

执行下面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. 程序崩溃

正确答案:B

试卷来源:202512 CCF-GESP编程能力等级认证C++四级真题

本卷相关题目

在线做题 同科目题库