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