O. [GESP]L4-202512-Q3625-S

    客观题

[GESP]L4-202512-Q3625-S

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

执行下面 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;
}

{{ select(1) }}

  • A0
  • B-1
  • A10
  • 程序崩溃

GESP 2025.12 C++ 四级 全真模拟赛

未参加
状态
已结束
规则
OI
题目
27
开始于
2026-11-20 13:33
结束于
2026-11-25 13:33
持续时间
2 小时
主持人
参赛人数
0