永发信息网

求C语言课程设计《商场店面管理系统》谢谢了

答案:1  悬赏:0  手机版
解决时间 2021-01-31 07:58
  • 提问者网友:不爱我么
  • 2021-01-30 13:21
求C语言课程设计《商场店面管理系统》谢谢了
最佳答案
  • 五星知识达人网友:逃夭
  • 2021-01-30 14:28
#include#include#include#include#defineNULL0#defineMaxSize30typedefstructathletestruct{charname[20];intscore;intrange;intitem;}ATH;typedefstructschoolstruct{intcount;intserial;intmenscore;intwomenscore;inttotalscore;ATHathlete[MaxSize];structschoolstruct*next;}SCH;intnsc,msp,wsp;intntsp;inti,j;intovergame;intserial,range;intn;SCH*head,*pfirst,*psecond;int*phead=NULL,*pafirst=NULL,*pasecond=NULL;input(){charanswer;head=(SCH*)malloc(sizeof(SCH));head->next=NULL;pfirst=head;answer='y';while(answer=='y'){Is_Game_DoMain:printf("\nGETTop5whenodd\nGETTop3wheneven");printf("\n输入运动项目序号(xnsc){printf("\n超过学校数目,请重新输入");gotoIs_Serial_DoMain;}if(head->next==NULL){create();}psecond=head->next;while(psecond!=NULL){if(psecond->serial==serial){pfirst=psecond;pfirst->count=pfirst->count+1;gotoStore_Data;}else{psecond=psecond->next;}}create();Store_Data:pfirst->athlete[pfirst->count].item=overgame;pfirst->athlete[pfirst->count].range=i;pfirst->serial=serial;("Inputname:):");scanf("%s",pfirst->athlete[pfirst->count].name);}printf("\n继续输入运动项目(y&n)?");answer=getch();printf("\n");}}calculate(){pfirst=head->next;while(pfirst->next!=NULL){for(i=1;icount;i++){if(pfirst->athlete[i].item%2==0){switch(pfirst->athlete[i].range){case1:pfirst->athlete[i].score=5;break;case2:pfirst->athlete[i].score=3;break;case3:pfirst->athlete[i].score=2;break;}}else{switch(pfirst->athlete[i].range){case1:pfirst->athlete[i].score=7;break;case2:pfirst->athlete[i].score=5;break;case3:pfirst->athlete[i].score=3;break;case4:pfirst->athlete[i].score=2;break;case5:pfirst->athlete[i].score=1;break;}}if(pfirst->athlete[i].itemmenscore=pfirst->menscore+pfirst->athlete[i].score;}else{pfirst->womenscore=pfirst->womenscore+pfirst->athlete[i].score;}}pfirst->totalscore=pfirst->menscore+pfirst->womenscore;pfirst=pfirst->next;}}output(){pfirst=head->next;psecond=head->next;while(pfirst->next!=NULL){clrscr();printf("\n第%d号学校的结果成绩:",pfirst->serial);printf("\n\n项目的数目\t学校的名字\t分数");for(i=1;icount;j++){if(pfirst->athlete[j].item==i){printf("\n%d\t\t\t\t\t\t%s\n%d",i,pfirst->athlete[j].name,pfirst->athlete[j].score);break;}}}printf("\n\n\n\t\t\t\t\t\t按任意建进入下一页");getch();pfirst=pfirst->next;}clrscr();printf("\n运动会结果:\n\n学校编号\t男运动员成绩\t女运动员成绩\t总分");pfirst=head->next;while(pfirst->next!=NULL){printf("\n%d\t\t%d\t\t%d\t\t%d",pfirst->serial,pfirst->menscore,pfirst->womenscore,pfirst->totalscore);pfirst=pfirst->next;}printf("\n\n\n\t\t\t\t\t\t\t按任意建结束");getch();}create(){pfirst=(structschoolstruct*)malloc(sizeof(structschoolstruct));pfirst->next=head->next;head->next=pfirst;pfirst->count=1;pfirst->menscore=0;pfirst->womenscore=0;pfirst->totalscore=0;}voidSave(){FILE*fp;if((fp=fopen("school.dat","wb"))==NULL){printf("can'topenschool.dat\n");fclose(fp);return;}fwrite(pfirst,sizeof(SCH),10,fp);fclose(fp);printf("文件已经成功保存\n");}main(){system("cls");printf("\n\t\t\t运动会分数统计\n");printf("输入学校数目(x>=5):");scanf("%d",&nsc);printf("输入男选手的项目(x<=20):");scanf("%d",&msp);printf("输入女选手项目(<=20):");scanf("%d",&wsp);ntsp=msp+wsp;phead=calloc(ntsp,sizeof(int));pafirst=phead;pasecond=phead;input();calculate();output();Save();}另外,虚机团上产品团购,超级便宜
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯