测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A21975. 执⾏下⾯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) { cou…

单选题 较难

题目描述

执⾏下⾯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;
}

选项(单选)

上一题 下一题