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