提交时间:2024-01-23 16:55:21
运行 ID: 125426
#include<iostream> using namespace std; int main(){ int a,b; char c; cin>>a>>c>>b; switch(c){ case '+': cout<<a+b;break; case '-': cout<<a-b;break; case '*': cout<<a*b;break; case '/': if(b==0){ cout<<"Divided by zero!"; break; }else{ cout<<a/b; break; } default:cout<<"Invalid operator!"; } return 0; }