Skip to content

Commit c9f06c8

Browse files
A - A+B?
1 parent b60e349 commit c9f06c8

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

A(A+B).cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
yildiz
3+
*/
4+
#include <string>
5+
#include <iostream>
6+
#include <cmath>
7+
#include <algorithm>
8+
#include <vector>
9+
using namespace std;
10+
int main() {
11+
int t;
12+
cin >> t;
13+
14+
while (t--) {
15+
string s;
16+
cin >> s;
17+
int c = s[0] - '0';
18+
char ch = s[1];
19+
int y = s[2] - '0';
20+
21+
switch (ch) {
22+
case '+':
23+
cout << (y + c) << "\n";
24+
break;
25+
case '-':
26+
cout << (y - c) << "\n";
27+
break;
28+
case '*':
29+
cout << (y * c) << "\n";
30+
break;
31+
case '/':
32+
cout << (y / c) << "\n";
33+
break;
34+
}
35+
}
36+
37+
return 0;
38+
}

0 commit comments

Comments
 (0)