为什么本机验证可通过这里runtime?
查看原帖
为什么本机验证可通过这里runtime?
1495667
winner999楼主2024/11/20 19:07
#include <bits/stdc++.h>
using namespace std;
int main () {
	int a,b;
	char c;
	cin >> a >> b >> c;
	if (c == '+') {
		cout << a+b;
	}else if (c == '-') {
		cout << a - b;
	}else if (c == '*') {
		cout << a * b;
	}else if (c == '/') {
		cout << a / b;
	}else if ((a == 0 || b == 0) && c == '/' ){
		cout << "Divided by zero!";
	}else {
		cout << "Invalid operator";
	}
	return 0;
}
2024/11/20 19:07
加载中...