- #include
- using namespace std;
- int main()
- {
- int x, y;
- char c;
- cin >> x >> y >> c;
- switch (c)
- {
- case '+': cout << x + y; break;
- case '-': cout << x - y; break;
- case '*': cout << x * y; break;
- case '/':
- switch (y)
- {
- case 0: cout << "Divided by zero!"; return 0;
- default:cout << x / y; return 0;
- }
- default: cout << "Invalid operator!"; break;
- }
- return 0;
- }
