RE
查看原帖
RE
1625146
xzz1234567890楼主2025/8/29 19:56
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	char c;
	cin>>a>>b>>c;
	if(b==0&&c=='/'){
		cout<<"Divided by zero!";
	}
	if(c=='+'){
		cout<<a+b;
		return 0;
	}
	else if(c=='-'){
		cout<<a-b;
		return 0;
	}
	else if(c=='*'){
		cout<<a*b;
		return 0;
	}
	else if(c=='/'){
		cout<<a/b;
		return 0;
	}
	else{
		cout<<"Invalid operator!";
	}
	return 0;
}
2025/8/29 19:56
加载中...