#include <iostream>
#include <cstdlib> // для system
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
double a,b,sum,razn,del,proizv;
cout << " Input a,b ";
cin >> a >> b;
sum = a + b;
razn = a - b;
del = a / b;
proizv = a * b;
cout << a << " + " << b << " = " << sum << endl;
cout << a << " - " << b << " = " << razn << endl;
cout << a << " * " << b << " = " << proizv << endl;
try
if (b == 0)
throw 123;
}
cout << a << " / " << b << " = " << a / b << endl;
catch(int i)
cout << a << " / " << b << " = " << "Ошибка №" << i << " - на 0 делить нельзя!!!!" << endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cstdlib> // для system
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
double a,b,sum,razn,del,proizv;
cout << " Input a,b ";
cin >> a >> b;
sum = a + b;
razn = a - b;
del = a / b;
proizv = a * b;
cout << a << " + " << b << " = " << sum << endl;
cout << a << " - " << b << " = " << razn << endl;
cout << a << " * " << b << " = " << proizv << endl;
try
{
if (b == 0)
{
throw 123;
}
cout << a << " / " << b << " = " << a / b << endl;
}
catch(int i)
{
cout << a << " / " << b << " = " << "Ошибка №" << i << " - на 0 делить нельзя!!!!" << endl;
}
}