+ 1
c++
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. cout << a / b << endl; int a; int b; throw 0; if (b == 0) cin >> a >> b;
2 odpowiedzi
+ 7
for java use try-catch block...
for c++ search about exception handling....
+ 7
int a,b;
cin>>a>>b;
if(b==0)
throw 0;
cout<<a/b<<endl;