提交时间:2024-09-22 21:53:52
运行 ID: 51611
#include <bits/stdc++.h> using namespace std; int main() { int a, b; char ch; cin >> a >> b >> ch; if(ch == '+'){ cout << a+b; }else{ if(ch == '-'){ cout << a-b; }else{ if(ch == '*'){ cout << a*b; }else{ if(ch == '/'){ if(b == 0){ cout << "Divided by zero!"; }else{ cout << a/b;} }else{ cout << "Invalid operator!"; } } } } return 0; }