提交时间:2024-01-23 16:23:45
运行 ID: 125078
#include <bits/stdc++.h> using namespace std; int ans; void ddd(){cout << "Divided by zero!" << endl;} void ddd2(){cout << "Invalid operator!" << endl;} void bbb(){cout << ans << endl;} signed main() { int a,b; char c; cin >> a >> c >> b; ans = (c=='+'?a+b:(c=='-'?a-b:(c=='*'?a*b:(c=='/'?(b==0?-1:a/b):-2)))); ans==-1?ddd():(ans==-2?ddd2():bbb()); return 0; }