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