永发信息网

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

答案:1  悬赏:0  手机版
解决时间 2021-01-31 07:58
求C语言课程设计《商场店面管理系统》谢谢了
最佳答案
#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();}另外,虚机团上产品团购,超级便宜
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
南台子乡南台子小学地址有知道的么?有点事想
自尊的重要表现是 A知耻 B.
小牛群镇大牛群寄宿制小学怎么去啊,我要去那
求问win10插网线连不了宽带怎么破
用0清除U盘重要数据 和 用1清除U盘重要数据
84和63的最大公因数和最小公倍数(过程给我,
吠奢的意思是什么啊?知道的请说下!
八里罕镇八里罕小学地址有知道的么?有点事想
格力空调的品悦系列和冷静王各自的优缺点都有
我哥在坐牢,刚听说他在里面被人打,被人敲诈
天义第三实验小学地址在什么地方,我要处理点
我和我老婆结婚,还没孩子,现在计划办通知去
松下AG-DVX200MC与松下 AG-AC160MC 哪个好?
尘霾的意思是什么啊?知道的请说下!
宁城县苏木皋民族小学地址有知道的么?有点事
推荐资讯
形容星星的词语
济阳晚枫酒吧地址在哪,我要去那里办事
顺利达运输公司地址有知道的么?有点事想过去
邦邦忙电脑维修地址好找么,我有些事要过去
小麦喜欢弱碱水还是弱酸水
女友家逼我婚前就买房子写女友名字
当你建议全家一起去公园时,说:(英语)
在网络计划实施中,当实际进度比计划进度拖后
延脑有什么功能?
一般认为,北宋风俗画,《清明上河图》描绘的
b桌球城地址在哪,我要去那里办事
东水中心小学地址好找么,我有些事要过去
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?