内容发布更新时间 : 2024/11/13 4:10:27星期一 下面是文章的全部内容请认真阅读。
int i,flag=1; if(top[0]==0&&top[1]==0&&top[2]==0) flag=0; else
if((top[0]==top[1]&&top[0]!=0)||(top[0]==top[2]&&top[0]!=0)||(top[1]==top[2]&&top[1]!=0)) flag=0; else for(i=0;i<3;i++) if(top[i]<0||top[i]>M) { flag=0;break; } return flag; }
void scoring(struct player ply[M],struct vote vot[N]) { int i,flag,one,two,three; for(i=0;i
ply[two].score=ply[two].score+2; ply[two].votes++; } if(three>=0) {
ply[three].score=ply[three].score+1; ply[three].votes++; } } }
6
}
void orig_to_file(struct player ply[M],struct vote vot[N]) {
int i;
FILE *fp;
if((fp=fopen(\ {
printf(\ exit(0); }
fprintf(fp,\
fprintf(fp,\ for(i=0;i fprintf(fp,\ fprintf(fp,\ fprintf(fp,\ for(i=0;i fprintf(fp,\d); fclose(fp); } void load_mod(struct player ply[M],struct vote vot[N]) { input_inf(ply,vot); scoring(ply,vot); orig_to_file(ply,vot); } void output_player(struct player ply[M]) { int i; printf(\ printf(\ for(i=0;i void output_vote(struct vote vot[N]) { int i; 7 printf(\ printf(\ for(i=0;i void search_num_player(struct player ply[M]) { int i,n,flag=0; printf(\ input the num: \ scanf(\ printf(\ result:\\n\ printf(\ for(i=0;i void search_name_player(struct player ply[M]) { int i,flag=0; char n[20]; printf(\ scanf(\ printf(\ printf(\ for(i=0;i 8 void search_player(struct player ply[M]) { int w; printf(\ scanf(\ if(w==1) search_num_player(ply); else if(w==2) search_name_player(ply); else printf(\ } void search_num_vote(struct vote vot[N]) { int i,n,flag=0; printf(\ scanf(\ printf(\ printf(\ for(i=0;i void super_player(struct player ply[M]) { int a,b,c; int i; FILE *fp; a=b=c=0; for(i=1;i 9 if(ply[i].score>ply[a].score) { c=b; b=a; a=i; } else if(ply[i].score==ply[a].score) { if(ply[i].votes>=ply[a].votes) { c=b; b=a; a=i; } else { c=b; b=i; } } else { if(ply[i].score>ply[b].score) { c=b; b=i; } else if(ply[i].score==ply[b].score) { if (ply[i].votes>=ply[c].votes) { c=b;b=i; } else c=i; } else if(ply[i].score>ply[c].score) c=i; } } if((fp=fopen(\ { printf(\ exit(0); } 10