注意:
1、每一个case后面要有break
2、/运算的时候注意分母不能为0
int a, b;char c;cin>>a>>b>>c;switch (c){case '+':cout << a << '+' << b << '=' << a + b << endl;break;case '-':cout << a << '-' << b << '=' << a - b << endl;break;case '*':cout << a << '*' << b << '=' << a * b << endl;break;case '/':if (b == 0){cout << "分母不能为0" << endl;}elsecout << a << '/' << b << '=' << a /b << endl;break;default:cout << "表达式错误" << endl;}