用C编写的运动会统计系统.docx
《用C编写的运动会统计系统.docx》由会员分享,可在线阅读,更多相关《用C编写的运动会统计系统.docx(25页珍藏版)》请在冰豆网上搜索。
用C编写的运动会统计系统
/*输入各项目的前三名或前五名*/
#include
#defineN5/*学校参加数*/
#defineM5/*男子项目数*/
#defineW5/*女子项目数*/
typedefstruct
{charschoolno[10];/*学校编号*/
charschoolname[20];/*学校名称*/
intscore;/*各学校所得的分数*/
}school;
typedefstructitem{/*定义项目结构体*/
schoolsch[N];
charitemno[10];/*项目编号*/
}item;
itemitemset[M+W];
/*初始化项目数组*//*凡是输入以后都从文件中读入*/
voidinit_itemset(itemitemset[])
{inti,j;
for(i=0;i{printf("输入第%d个项目\n",i+1);scanf("%s",itemset[i].itemno);for(j=0;j{printf("输入学校编号和名称\n");scanf("%s",itemset[i].sch[j].schoolno);scanf("%s",itemset[i].sch[j].schoolname);itemset[i].sch[j].score=0;}}}voidcreateDataBase(itemitemset[])/*写文件*/{FILE*fp;inti,j;for(i=0;i{for(j=0;j{scanf("%s",itemset[i].sch[j].schoolno);scanf("%s",itemset[i].sch[j].schoolname);scanf("%d",&itemset[i].sch[j].score);}scanf("%s",itemset[i].itemno);}if((fp=fopen("wenjian5","wb"))==NULL){printf("cannotopenfile\n");return;}for(i=0;iif(fwrite(&itemset[i],sizeof(structitem),1,fp)!=1)printf("filewriteerror");fclose(fp);}voidreadDataBase()/*读文件*/{inti,j;FILE*fp;if((fp=fopen("wenjian5","rb"))==NULL){printf("cannotopenfile\n");return;}/*for(i=0;iif(fread(&itemset[i],sizeof(structitem),1,fp)!=1){if(feof(fp)){fclose(fp);return;}printf("filereaderror");}*/for(i=0;ifread(&itemset[i],sizeof(structitem),1,fp);fclose(fp);for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{printf("输入第%d个项目\n",i+1);
scanf("%s",itemset[i].itemno);
for(j=0;j{printf("输入学校编号和名称\n");scanf("%s",itemset[i].sch[j].schoolno);scanf("%s",itemset[i].sch[j].schoolname);itemset[i].sch[j].score=0;}}}voidcreateDataBase(itemitemset[])/*写文件*/{FILE*fp;inti,j;for(i=0;i{for(j=0;j{scanf("%s",itemset[i].sch[j].schoolno);scanf("%s",itemset[i].sch[j].schoolname);scanf("%d",&itemset[i].sch[j].score);}scanf("%s",itemset[i].itemno);}if((fp=fopen("wenjian5","wb"))==NULL){printf("cannotopenfile\n");return;}for(i=0;iif(fwrite(&itemset[i],sizeof(structitem),1,fp)!=1)printf("filewriteerror");fclose(fp);}voidreadDataBase()/*读文件*/{inti,j;FILE*fp;if((fp=fopen("wenjian5","rb"))==NULL){printf("cannotopenfile\n");return;}/*for(i=0;iif(fread(&itemset[i],sizeof(structitem),1,fp)!=1){if(feof(fp)){fclose(fp);return;}printf("filereaderror");}*/for(i=0;ifread(&itemset[i],sizeof(structitem),1,fp);fclose(fp);for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{printf("输入学校编号和名称\n");
scanf("%s",itemset[i].sch[j].schoolno);
scanf("%s",itemset[i].sch[j].schoolname);
itemset[i].sch[j].score=0;
}
voidcreateDataBase(itemitemset[])/*写文件*/
{
FILE*fp;
inti,j;
for(i=0;i{for(j=0;j{scanf("%s",itemset[i].sch[j].schoolno);scanf("%s",itemset[i].sch[j].schoolname);scanf("%d",&itemset[i].sch[j].score);}scanf("%s",itemset[i].itemno);}if((fp=fopen("wenjian5","wb"))==NULL){printf("cannotopenfile\n");return;}for(i=0;iif(fwrite(&itemset[i],sizeof(structitem),1,fp)!=1)printf("filewriteerror");fclose(fp);}voidreadDataBase()/*读文件*/{inti,j;FILE*fp;if((fp=fopen("wenjian5","rb"))==NULL){printf("cannotopenfile\n");return;}/*for(i=0;iif(fread(&itemset[i],sizeof(structitem),1,fp)!=1){if(feof(fp)){fclose(fp);return;}printf("filereaderror");}*/for(i=0;ifread(&itemset[i],sizeof(structitem),1,fp);fclose(fp);for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{for(j=0;j{scanf("%s",itemset[i].sch[j].schoolno);scanf("%s",itemset[i].sch[j].schoolname);scanf("%d",&itemset[i].sch[j].score);}scanf("%s",itemset[i].itemno);}if((fp=fopen("wenjian5","wb"))==NULL){printf("cannotopenfile\n");return;}for(i=0;iif(fwrite(&itemset[i],sizeof(structitem),1,fp)!=1)printf("filewriteerror");fclose(fp);}voidreadDataBase()/*读文件*/{inti,j;FILE*fp;if((fp=fopen("wenjian5","rb"))==NULL){printf("cannotopenfile\n");return;}/*for(i=0;iif(fread(&itemset[i],sizeof(structitem),1,fp)!=1){if(feof(fp)){fclose(fp);return;}printf("filereaderror");}*/for(i=0;ifread(&itemset[i],sizeof(structitem),1,fp);fclose(fp);for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{scanf("%s",itemset[i].sch[j].schoolno);
scanf("%d",&itemset[i].sch[j].score);
if((fp=fopen("wenjian5","wb"))==NULL)
{printf("cannotopenfile\n");
return;}
for(i=0;iif(fwrite(&itemset[i],sizeof(structitem),1,fp)!=1)printf("filewriteerror");fclose(fp);}voidreadDataBase()/*读文件*/{inti,j;FILE*fp;if((fp=fopen("wenjian5","rb"))==NULL){printf("cannotopenfile\n");return;}/*for(i=0;iif(fread(&itemset[i],sizeof(structitem),1,fp)!=1){if(feof(fp)){fclose(fp);return;}printf("filereaderror");}*/for(i=0;ifread(&itemset[i],sizeof(structitem),1,fp);fclose(fp);for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
if(fwrite(&itemset[i],sizeof(structitem),1,fp)!
=1)
printf("filewriteerror");
fclose(fp);
voidreadDataBase()/*读文件*/
if((fp=fopen("wenjian5","rb"))==NULL)
return;
/*for(i=0;iif(fread(&itemset[i],sizeof(structitem),1,fp)!=1){if(feof(fp)){fclose(fp);return;}printf("filereaderror");}*/for(i=0;ifread(&itemset[i],sizeof(structitem),1,fp);fclose(fp);for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
if(fread(&itemset[i],sizeof(structitem),1,fp)!
{if(feof(fp)){fclose(fp);return;}
printf("filereaderror");
}*/
for(i=0;ifread(&itemset[i],sizeof(structitem),1,fp);fclose(fp);for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
fread(&itemset[i],sizeof(structitem),1,fp);
for(i=0;i{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{for(j=0;jprintf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);printf(",%s\n",itemset[i].itemno);}getch();}/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore){inti,j,k;for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
printf("%s,%s,%d\n",itemset[i].sch[j].schoolno,itemset[i].sch[j].schoolname,itemset[i].sch[j].score);
printf(",%s\n",itemset[i].itemno);
getch();
/*用以查找与输入项目号,学校相应的信息,并修改相应学校在相应项目所得分等其他信息*/
voidsearch(itemitemset[],charitemno[],charschoolno[],charschoolname[],intscore)
{inti,j,k;
for(i=0;i{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;}for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/
break;
for(j=0;j{if(strcmp(itemset[j].itemno,itemno)==0)break;}itemset[j].sch[i].score+=score;//printf("%d\n",itemset[j].sch[i].score); if(j>N){printf("输入的学校编号出错\n");}if(i>M+W){printf("输入的项目编号出错\n");}}voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/{charschoolno[10];charschoolname[20];intscore;inti,j;intk;intn;intm=1;charitemno[10];printf("输入第%d组数据\n",m);printf("请输入项目号:");scanf("%s",itemno);while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/{printf("请输入3或5代表输入前三名或前五名:");scanf("%d",&k);if(k==3)/*如果i等于0,就代表输入的是前三名*/{printf("第一名加5分\n");printf("第二名加3分\n");printf("第三名加2分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==5)||(score==3)||(score==2)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}if(k==5)/*如果i等于5,就代表输入的是前五名*/{printf("第一名加7分\n");printf("第二名加5分\n");printf("第三名加3分\n");printf("第四名加2分\n");printf("第五名加1分\n");printf("请输入学校编号:");scanf("%s",schoolno);printf("请输入学校名称:");scanf("%s,",schoolname);printf("请输入所得分数:");scanf("%d",&score);if((score==7)||(score==5)||(score==3)||(score==2)||(score==1)){m++;search(itemset,itemno,schoolno,schoolname,score);}elseprintf("输入的分数有误\n");}printf("请输入项目号:");scanf("%s",itemno);if(strcmp(itemno,"-1")){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入数据输入系统*************\n");printf("================================================\n");printf("\n\n");printf("输入第%d组数据\n",m);printf("项目号%s:\n",itemno);printf("\n\n");}}}/*求各学校的总分,记住要把结果写到文件中去*/voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/{inti,j;for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{if(strcmp(itemset[j].itemno,itemno)==0)
itemset[j].sch[i].score+=score;
//printf("%d\n",itemset[j].sch[i].score);
if(j>N)
{printf("输入的学校编号出错\n");
if(i>M+W)
{printf("输入的项目编号出错\n");
voidinputData(itemitemset[])/*用i决定输入的是前三名还是前五名*/
charschoolno[10];
charschoolname[20];
intscore;
intk;
intn;
intm=1;
charitemno[10];
printf("输入第%d组数据\n",m);
printf("请输入项目号:
");
scanf("%s",itemno);
while(strcmp(itemno,"-1"))/*以项目号为-1作为输入的结束标志*/
{printf("请输入3或5代表输入前三名或前五名:
scanf("%d",&k);
if(k==3)/*如果i等于0,就代表输入的是前三名*/
{printf("第一名加5分\n");
printf("第二名加3分\n");
printf("第三名加2分\n");
printf("请输入学校编号:
scanf("%s",schoolno);
printf("请输入学校名称:
scanf("%s,",schoolname);
printf("请输入所得分数:
scanf("%d",&score);
if((score==5)||(score==3)||(score==2))
{m++;
search(itemset,itemno,schoolno,schoolname,score);
elseprintf("输入的分数有误\n");
if(k==5)/*如果i等于5,就代表输入的是前五名*/
{printf("第一名加7分\n");
printf("第二名加5分\n");
printf("第三名加3分\n");
printf("第四名加2分\n");
printf("第五名加1分\n");
if((score==7)||(score==5)||(score==3)||(score==2)||(score==1))
if(strcmp(itemno,"-1"))
{system("cls");
printf("\n");
printf("================================================\n");
printf("***************欢迎进入数据输入系统*************\n");
printf("\n\n");
printf("项目号%s:
\n",itemno);
/*求各学校的总分,记住要把结果写到文件中去*/
voidschoolSumScore(itemitemset[],intschScore[N])/*schScore[N]要在主函数里初始化*/
for(i=0;ifor(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
for(j=0;jschScore[i]+=itemset[j].sch[i].score;printf("学校编号==学校名称==所得总分\n");for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
schScore[i]+=itemset[j].sch[i].score;
printf("学校编号==学校名称==所得总分\n");
for(i=0;i{printf("%s%s%d\n",itemset[i].sch[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);}} /*实现排序的函数*/voidpaiXu(inta[],itemitem[]){inti,j,t;//itemitem[M+W];schooltemp;//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{printf("%s%s%d\n",itemset[i].sch
[i].schoolno,itemset[i].sch[i].schoolname,schScore[i]);
/*实现排序的函数*/
voidpaiXu(inta[],itemitem[])
{inti,j,t;
//itemitem[M+W];
schooltemp;
//for(i=0;i//item[i]=itemset[i];for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
//item[i]=itemset[i];
for(j=0;jfor(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
for(i=0;iif(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
if(a[i]{t=a[i];temp=item[0].sch[i];a[i]=a[i+1];item[0].sch[i]=item[0].sch[i+1];a[i+1]=t;item[0].sch[i+1]=temp;}printf("学校编号==学校名称==所得分\n");for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{t=a[i];
temp=item[0].sch[i];
a[i]=a[i+1];
item[0].sch[i]=item[0].sch[i+1];
a[i+1]=t;
item[0].sch[i+1]=temp;
printf("学校编号==学校名称==所得分\n");
for(i=0;i{printf("%s%s%d",item[0].sch[i].schoolno,item[0].sch[i].schoolname,a[i]);printf("\n");}} /*计算男团体总分,并排序*/voidmaleSumScore(itemitemset[]){inti,j;intmaleScore[N];itemmaleItem[M];for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{printf("%s%s%d",item[0].sch
[i].schoolno,item[0].sch[i].schoolname,a[i]);
/*计算男团体总分,并排序*/
voidmaleSumScore(itemitemset[])
intmaleScore[N];
itemmaleItem[M];
for(i=0;imaleItem[i]=itemset[i];for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
maleItem[i]=itemset[i];
for(i=0;imaleScore[i]=0;for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
maleScore[i]=0;
for(i=0;ifor(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
for(j=0;jmaleScore[i]+=maleItem[j].sch[i].score;//printf("%d",maleScore[i]);}paiXu(maleScore,maleItem);/*调用排序函数*/}/*计算女团体总分,并排序*/voidfemaleSumScore(itemitemset[]){inti,j;itemfemaleItem[W];intfemaleScore[N];for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
maleScore[i]+=maleItem[j].sch[i].score;
//printf("%d",maleScore[i]);}
paiXu(maleScore,maleItem);/*调用排序函数*/
/*计算女团体总分,并排序*/
voidfemaleSumScore(itemitemset[])
itemfemaleItem[W];
intfemaleScore[N];
for(i=M;ifemaleItem[i-M]=itemset[i];for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
femaleItem[i-M]=itemset[i];
for(i=0;ifemaleScore[i]=0;for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
femaleScore[i]=0;
for(i=0;ifor(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
for(j=M;jfemaleScore[i]+=femaleItem[j-M].sch[i].score;//printf("%d",femaleScore[i]);}paiXu(femaleScore,femaleItem);/*调用排序函数*/} /*按学校编号查询学校某个项目的情况*/voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[]){inti,j,k;for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
femaleScore[i]+=femaleItem[j-M].sch[i].score;
//printf("%d",femaleScore[i]);}
paiXu(femaleScore,femaleItem);/*调用排序函数*/
/*按学校编号查询学校某个项目的情况*/
voidsearchItemSchool(itemitemset[],charschoolno[],charitemno[])
for(i=0;iif(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/break;for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
if(strcmp(itemset[0].sch[i].schoolno,schoolno)==0)/*先找到学校编号*/
for(j=0;jif(strcmp(itemset[j].itemno,itemno)==0)break;printf("项目编号学校编号学校名称分数\n");printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个项目的总分情况,男女团体总分情况*/}/*按项目查询该项目的前五名或前三名*/voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/{inti,j,k,n;itemitem[M+W];schoolschTemp;for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
if(strcmp(itemset[j].itemno,itemno)==0)
printf("项目编号学校编号学校名称分数\n");
printf("%s%s%s%d\n",itemset[j].itemno,itemset[j].sch[i].schoolno,itemset[j].sch
[i].schoolname,itemset[j].sch[i].score);/*从文件中读出第i个学校,第j个
项目的总分情况,男女团体总分情况*/
/*按项目查询该项目的前五名或前三名*/
voidtopSchoolByItem(itemitemset[],charitemno[],intq)/*用i来确定是输出前五名还是前三名*/
{inti,j,k,n;
itemitem[M+W];
schoolschTemp;
for(i=0;iitem[i]=itemset[i];for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
item[i]=itemset[i];
for(i=0;iif(strcmp(itemset[i].itemno,itemno)==0)break;for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
if(strcmp(itemset[i].itemno,itemno)==0)
for(j=0;j{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{for(k=0;kif(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
if(item[i].sch[k].score{schTemp=item[i].sch[i];item[i].sch[i]=item[i].sch[i+1];item[i].sch[i+1]=schTemp;}}printf("项目编号名次学校编号学校名称分数\n");if(q==3)/*用q=3表示输出前三名*/for(n=0;n<3;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}if(q==5)/*用q=5表示输出前五名*/for(n=0;n<5;n++){printf("%s%d%s%s%d",item[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch[n].schoolname,item[i].sch[n].score);printf("\n");}}voidwelcomeJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n");printf("1输入数据\n");printf("2排序\n");printf("3查询\n");printf("-1退出运动会统计系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidpaixuJieMian(){system("cls");printf("\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");printf("\n\n");printf("1得到按各学校总分排序的结果\n");printf("2得到按各学校男团体总分排序的结果\n");printf("3得到按各学校女团体总分排序的结果\n");printf("-1退出排序系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("================================================\n");printf("***************欢迎进入排序系统*****************\n");printf("================================================\n");}voidchaXunJieMian(){system("cls");printf("\n\n\n\n");printf("================================================\n");printf("****************欢迎进入查询系统****************\n");printf("================================================\n");printf("\n\n");printf("1按学校编号查询学校某个项目的情况\n");printf("2按项目查询该项目的前五名或前三名\n");printf("-1退出查询系统\n");printf("请选择您所需要的功能:");printf("\n\n\n");printf("===============================================\n");printf("***************欢迎进入查询系统****************\n");printf("===============================================\n");}voidxuanZeJieMian(){printf("\n\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");printf("\n\n\n");printf("1管理员\n");printf("2非管理员\n");printf("-1退出查询系统\n");printf("请选择:\n");printf("\n\n\n");printf("================================================\n");printf("*************欢迎进入运动会统计系统*************\n");printf("================================================\n");}voidmain(){intchoice,choice1,choice2,choice3;//选择界面intq;inti;longkey;//密码intexitno;//控制界面跳转charschoolno[10];charitemno[10];intschScore[N];//itemitemset[M+W];//init_itemset(itemset);//createDataBase(itemset);readDataBase();for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{schTemp=item[i].sch[i];
item[i].sch[i]=item[i].sch[i+1];
item[i].sch[i+1]=schTemp;
printf("项目编号名次学校编号学校名称分数\n");
if(q==3)/*用q=3表示输出前三名*/
for(n=0;n<3;n++)
{printf("%s%d%s%s%d",item
[i].itemno,n+1,item[i].sch[n].schoolno,item[i].sch
[n].schoolname,item[i].sch[n].score);
if(q==5)/*用q=5表示输出前五名*/
for(n=0;n<5;n++)
[i].itemno,n+1,item[i].sch[n].schoolno,item
[i].sch[n].schoolname,item[i].sch[n].score);
voidwelcomeJieMian()
printf("\n\n\n\n");
printf("*************欢迎进入运动会统计系统*************\n");
printf("1输入数据\n");
printf("2排序\n");
printf("3查询\n");
printf("-1退出运动会统计系统\n");
printf("请选择您所需要的功能:
printf("\n\n\n");
voidpaixuJieMian()
printf("***************欢迎进入排序系统*****************\n");
printf("1得到按各学校总分排序的结果\n");
printf("2得到按各学校男团体总分排序的结果\n");
printf("3得到按各学校女团体总分排序的结果\n");
printf("-1退出排序系统\n");
voidchaXunJieMian()
printf("****************欢迎进入查询系统****************\n");
printf("1按学校编号查询学校某个项目的情况\n");
printf("2按项目查询该项目的前五名或前三名\n");
printf("-1退出查询系统\n");
printf("===============================================\n");
printf("***************欢迎进入查询系统****************\n");
voidxuanZeJieMian()
{printf("\n\n\n\n");
printf("1管理员\n");
printf("2非管理员\n");
printf("请选择:
\n");
voidmain()
{intchoice,choice1,choice2,choice3;//选择界面
intq;
inti;
longkey;//密码
intexitno;//控制界面跳转
intschScore[N];
//itemitemset[M+W];
//init_itemset(itemset);
//createDataBase(itemset);
readDataBase();
for(i=0;i{schScore[i]=0;}welcomeJieMian();//进入主菜单界面scanf("%d",&choice);//xuanZeJieMian();//scanf("%d",choice3);/*while(choice3!=-1){if(choice3!=1&&choice3!=2){system("cls");xuanZeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");scanf("%d",&choice3);}switch(choice3){case1:*/welcomeJieMian();//进入主菜单界面scanf("%d",&choice);{while(choice!=-1)//实现界面跳转{if(choice!=1&&choice!=2&&choice!=3){system("cls");welcomeJieMian();printf("功能选择错误\n");printf("请选择您所需要的功能:");
{schScore[i]=0;}
welcomeJieMian();//进入主菜单界面
scanf("%d",&choice);
//xuanZeJieMian();
//scanf("%d",choice3);
/*while(choice3!
=-1)
{if(choice3!
=1&&choice3!
=2)
xuanZeJieMian();
printf("功能选择错误\n");
scanf("%d",&choice3);
switch(choice3)
{case1:
*/welcomeJieMian();//进入主菜单界面
{while(choice!
=-1)//实现界面跳转
{if(choice!
=1&&choice!
=2&&choice!
=3)
welcomeJieMian();
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1