为什么都是零?我不理解?struct做的
查看原帖
为什么都是零?我不理解?struct做的
922691
Hisy楼主2023/8/13 20:08
#include<cstdio>
struct node{
	int win[62526],lose[62526],count=0,match=0;
};
int main(){
	node match11,match21;
	char got;
	while(got=getchar()!='E'){
		if(got==' '||got=='\n'){
			continue;
		};
		match11.count++;
		match21.count++;
		if(match11.count==12){
			match11.count=1;
			match11.match++;
		};
		if(match21.count==22){
			match21.count=1;
			match21.match++;
		};
		if(got=='W'){
			match11.win[match11.match]++;
			match21.win[match21.match]++; 
		};
		if(got=='L'){
			match11.lose[match11.match]++;
			match21.lose[match21.match]++;
		};
	};
	for(int it=1;it<=match11.match;it++){
		printf("%d:%d\n",match11.win[it],match11.lose[it]);
	};
	for(int it=1;it<=match21.match;it++){
		printf("%d:%d\n",match21.win[it],match21.lose[it]);
	};
	return 0;
};
2023/8/13 20:08
加载中...