+ 1
exception
Rearrange the code to declare two integer variables: a and b, print to the screen the division equation a/b. If b is equal to 0, throw an exception with a 0 value. cin >> a >> b; int a; int b; throw 0; cout << a / b << endl; if (b == 0)
3 Answers
+ 5
int a; int b;
cin >> a >> b;
if (b == 0)
throw 0;
cout << a / b << endl;
0
int a; int b;
cin >> a >> b;
if (b == 0)
throw 0;
cout << a / b << endl;
0
Rearrange the code to declare two integer variables: a and b, print to the screen the division equation a/b. If b is equal to 0, throw an exception with a 0 value.
Answer:
int a; int b;
cin >> a >> b;
if (b == 0)
throw 0;
cout << a / b << endl;