-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathARITH2.cpp
43 lines (41 loc) · 821 Bytes
/
ARITH2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int T;
cin >> T;
cin.ignore(100, '\n');
while (T--)
{
long long int num1, num2;
char op;
cin >> num1;
cin >> op;
while (op != '=')
{
cin >> num2;
if (op == '+')
{
num1 += num2;
cin >> op;
}
else if (op == '-')
{
num1 -= num2;
cin >> op;
}
else if (op == '*')
{
num1 *= num2;
cin >> op;
}
else if (op == '/')
{
num1 /= num2;
cin >> op;
}
}
cout << num1 << endl;
}
}