Last active
July 26, 2017 19:59
-
-
Save MohamedTaha98/4e235cc67cce75f89f347777432db35c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int n; | |
cin >> n; | |
long long x, y; | |
char op; | |
for (int i = 0; i < n; i++) { | |
cin >> x >> op; | |
while (op != '=') { | |
cin >> y; | |
switch (op) { | |
case '+': | |
x += y; | |
break; | |
case '-': | |
x -= y; | |
break; | |
case '*': | |
x *= y; | |
break; | |
case '/': | |
x /= y; | |
break; | |
default: | |
break; | |
} | |
cin >> op; | |
} | |
cout << x << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment