编译错误,c++上却可以
查看原帖
编译错误,c++上却可以
1074475
LANXIANGYU0329楼主2023/11/18 14:19
#include<iostream>
using namespace std;
int main(){
	int a,b;
	char c;
	cin>>a>>b>>c;
	if(c=='+'){
		cout<<a+b;
	}else{
		cout<<"Invalid"<<" "<<"operator!";
	if(c=='-'){
		cout<<a-b;
	}else{
		cout<<cout<<"Invalid"<<" "<<"operator!";
	if(c=='*'){
		cout<<a*b;
	}else{
		cout<<"Invalid"<<" "<<"operator!";
	
	if(c=='/' && b==0){
		cout<<"Divided"<<" "<<"by"<<" "<<"zero!";
	}
	if(c=='/' && b!=0){
		cout<<a/b;
	}else{
		cout<<"Invalid"<<" "<<"operator!";
	}
	}
	}
	}
	return 0;
}
2023/11/18 14:19
加载中...