-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy patharith2.cpp
More file actions
43 lines (37 loc) · 729 Bytes
/
arith2.cpp
File metadata and controls
43 lines (37 loc) · 729 Bytes
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<bits/stdc++.h>
using namespace std;
int main(){
long long t,a,b,res;
char op;
cin>>t;
while(t--){
op='n';
a=0;
b=0;
cin>>a;
cin>>op;
while(op!='='){
cin>>b;
if(op=='*'){
a= a*b;
cin>>op;
}
else if(op=='+'){
a= a+b;
cin>>op;
}
else if(op=='/'){
a= a/b;
cin>>op;
}
else if(op=='-'){
a= a-b;
cin>>op;
}
}
if(op=='='){
cout<<a<<endl;
}
}
return 0;
}