M. [GESP]L4-202406-Q2419-S

    客观题

[GESP]L4-202406-Q2419-S

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

下面的程序中,如果输入 10 0 ,会输出( )。

#include<iostream>
using namespace std;

double Division(int a, int b)
{
    if (b == 0)
        throw "Division by zero condition!";
    else
        return ((double)a / (double)b);
}

void func()
{
    int len, time;
    cin >> len >> time;
    cout << Division(len, time) << endl;
}

int main()
{
    try {
        func();
    }
    catch (const char* errmsg)
    {
        cout << errmsg << endl;
    }
    catch (const int errmsg)
    {
        cout << errmsg << endl;
    }
    return 0;
}

{{ select(1) }}

  • Division by zero condition!
  • 0
  • 10
  • 100

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

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