exception | SoloLearn: Learn to code for FREE!

+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)

4/9/2017 4:04:50 AM

sankavi v

3 Answers

New Answer

+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;