提交时间:2024-01-23 16:38:49

运行 ID: 125253

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