提交时间:2024-01-23 16:43:22

运行 ID: 125312

#include<iostream> using namespace std; int main(){ int a,b; char f; cin>>a>>f>>b; switch(f){ case '+':cout<<a+b;break; case '-':cout<<a-b;break; case '/':if(b==0) cout<<"Divided by zero!"; else cout<<a/b;break; case '*':cout<<a*b;break; default:cout<<"Invalid operator!"; } return 0; }