Untitled
unknown
plain_text
3 years ago
2.5 kB
5
Indexable
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
string n;
int a, b, c, d=0,e=0;
cout << "Операции:" << endl;
cout << "1 — A + B" << endl;
cout << "2 — A - B" << endl;
cout << "3 — A * B" << endl;
cout << "4 — А / В" << endl;
cout << "5 — A % B" << endl;
cout << "6 — Aᴮ" << endl;
cout << "7 — A% от B" << endl << endl;
while(1){
if(e==0){
cout << "Введите '>' или 'Старт' для начала, что бы завершить введите 'X'" << endl << endl;
e++;
}
else{
cout << endl;
cout << "Введите '>' что бы продолжить, что бы завершить введите 'X'" << endl << endl;
}
d=0;
while(d==0){
cin >> n;
if(n=="Старт" || n==">"){
cout << "Введите 'A' и 'B': ";
cin >> a >> b;
cout << endl;
cout << "Введите номер операции: ";
cin >> c;
cout << endl;
switch(c)
{
case 1:
cout << "Ответ: " << a+b << endl;
d++;
break;
case 2:
cout << "Ответ: " << a-b << endl;
d++;
break;
case 3:
cout << "Ответ: " << a*b << endl;
d++;
break;
case 4:
cout << "Ответ: " << float(a/b) << endl;
d++;
break;
case 5:
cout << "Ответ: " << a%b << endl;
d++;
break;
case 6:
cout << "Ответ: " << pow(a,b) << endl;
d++;
break;
case 7:
cout << "Ответ: " << float((a*b)/100) << endl;
d++;
break;
}
}
if(n=="Х" || n=="X"){
return 0;
}
}
}
}Editor is loading...