提交时间:2024-01-23 16:36:09
运行 ID: 125229
#include<iostream> using namespace std; int main(){ int a,b; char c; cin>>a>>c>>b; if(c=='/' && b==0){ cout<<"Divided by zero!"<<endl; exit(0); } if(c=='+'){ cout<<a+b<<endl; } else if(c=='-'){ cout<<a-b<<endl; } else if(c=='*'){ cout<<a*b<<endl; } else if(c='/'){ cout<<a/b<<endl; } else cout<<"Invalid operator!"<<endl; return 0; }