提交时间:2023-08-10 12:56:54
运行 ID: 24290
#include<iostream> using namespace std; int main(){ int a,b; char s; cin>>a>>b>>s; switch (s) { 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; }