第23588题 单选题
执行以下C++代码,最终的输出结果是什么?

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

程序崩溃

程序运行统计
暂无判题统计
提交0次 正确率0.00%
答案解析