提交时间:2024-10-27 16:03:04

运行 ID: 54377

#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; }