题解
2025-09-20 15:08:40
发布于:广东
3阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,d;
char c;
cin>>a>>b>>c;
if(c=='/'||c=='+'||c=='*'||c=='-')a=a+0;
else cout<<"Invalid operator!";
if(c=='+')cout<<a+b<<endl;
if(c=='-')cout<<a-b<<endl;
if(c=='*')cout<<a*b<<endl;
if(c=='/') b==0?cout<<"Divided by zero!":cout<<a/b;
return 0;
}
这里空空如也
有帮助,赞一个