#3106. [GESP202406 四级 C++] 第 13 题

[GESP202406 四级 C++] 第 13 题

下面的程序中,如果输入 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