试试这个有点长的代码
查看原帖
试试这个有点长的代码
1236011
caixuhao楼主2024/7/6 20:00
#include <bits/stdc++.h>
using namespace std;
int main () {
	long long n;
	cin>>n;
	int positive;
	int zero;
	int negative;
	positive=0;
	zero=0;
	negative=0;
	if(n>0){
		positive+=1;
	}
	if(n==0){
		zero+=1;
	}
	if(n<0){
		negative+=1;
	}
	int max;
	max=positive;
	if(max<zero){
		max=zero;
	}
	if(max<negative){
		max=negative;
	}
	
	if(max=positive){
		cout<<"positive";
	} 
	if(max=zero){
		cout<<"zero";
	}
	if(max=negative){
		cout<<"negative";
	}
	return 0;
}
2024/7/6 20:00
加载中...