提交时间:2024-04-26 21:12:48

运行 ID: 46184

#include<bits/stdc++.h> using namespace std; int main() { int a,b; char c; cin>>a>>b>>c; if(c=='+') { cout<<a+b; return 0; } else if(c=='-') { cout<<a-b; return 0; } else if(c=='*') { cout<<a*b; return 0; } else if(c=='/') { if(b==0) { cout<<"Divided by zero"; return 0; } else { cout<<a/b; return 0; } return 0; } else { cout<<"Invalid operator"; return 0; } return 0; }