C语言---运动会管理系统

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

C语言运动会管理系统运动员信息包括:运动员编号、班级、姓名、竞技项目等。试设计一运动会管理系统,使之能提供以下功能:运动员信息录入功能(运动员信息用文件保存)——输入运动员信息浏览功能——输出查询和排序功能:(至少一种查询方式)——算法按竞技项目查询按姓名查询运动员信息删除、修改功能(人选项)问题补充:需要算法,流程图,总结!#includestdio.h#defineA100inty=0,f=0,j,W,M,N,p[15],q[15];structstudent{charshool[20];charname[20];charitem[20];charsex;intposition;intmark;}stu[A];structitem{charname[20];charsex;intmark;}it[A];structshool{charname[20];charitem[20];intmark;}sho[A];main(){menu();}menu(){intw1,n;do{puts(\t\t*****************MENU********************);puts(\n\n\t\t1.Theinformationtowritein\n);puts(\t\t2.Theraceresultrecordstowritein\n);puts(\t\t3.Searchtheinformation\n);puts(\t\t4.Exit\n);puts(\n\t\t*****************************************);puts(\n\nChoiceyounumber:);scanf(%d,&n);if(n1||n4){w1=1;getchar();}elsew1=0;}while(w1==1);switch(n){case1:establish();break;case2:enter();break;case3:search();break;case4:exit(0);}}establish(){inth,r;externN,M,W;y=1;printf(\nThenumberofshoolattendedis:);scanf(%d,&N);printf(\nThenumberofmenitemis:);scanf(%d,&M);printf(\nThenumberofwomenitemis:);scanf(%d,&W);printf(\nTherearethreeformofmarkedyoucanchoice:);printf(\n\n\t1).1th--7,2th--5,3th--3,4th--2,5th--1.);printf(\n\n\t2).1th--5,2th--3,3th--1.);printf(\n\n\t3).Definebyyouself.);loop:printf(\n\nChoicethenumber(1--3):);scanf(%d,&h);if(h0&&h4)switch(h){case1:j=1;break;case2:j=2;break;case3:define_mark();}elsegotoloop;printf(Success!!!\nPressanykey+Entertomenu..);scanf(%d,&r);menu();}enter(){intt,r,i=0;externj,y;charF,M;if(y==0){printf(Pleaseestablishsystemfirst!!\nPressanykey+Entertomenu..);scanf(%d,&r);menu();}do{printf(\nPleaseenterthestudent'sname:\t);scanf(%s,&stu[i].name);printf(\nPleaseenterthestudent'sshool:\t);scanf(%s,&stu[i].shool);printf(\nPleaseenterthestudent'sitem:\t);scanf(%s,&stu[i].item);loop_1:printf(\nPleaseenterthestudent'ssex(WorM):\t);scanf(%s,&stu[i].sex);if(stu[i].sex!='W'&&stu[i].sex!='M')gotoloop_1;printf(\nPleaseenterthestudent'sposition:\t);scanf(%d,&stu[i].position);mark(j,i);loop_2:printf(\n\nDoagain?\t1).Yes\t2).No\t);scanf(%d,&t);if(t!=2&&t!=1)gotoloop_2;if(t==2)break;i++;}while(t==1);f=1;printf(Success!!!\nPressanykey+Entertomenu..);scanf(%d,&r);menu();}search(){inte;charc;externf;if(f==0){printf(Pleaseenterthedatafirst!!\nPressanykey+Entertomenu..\n);scanf(%s,&c);menu();}loop:printf(\nTheformofsearchingyouwanttochoice:\n\t1).Byschool\n\t2).Btitem\n\t3).Tomenu\t);scanf(%d,&e);switch(e){case1:search_school();break;case2:search_item();break;case3:menu();}if(e4||e1)gotoloop;printf(Pressanykey+Entertomenu..);scanf(%s,&c);menu();}search_school(){intx,sum=0,w=0;structstudents;printf(\nPleaseenterthenameoftheschoolthatyouwanttosearch:);scanf(%s,&s.shool);printf_face();for(x=0;xA;x++)if(strcmp(s.shool,stu[x].shool)==0){sum+=stu[x].mark;printf_one(x);w=1;}printf_sum(sum);if(w==0){printf(\n\n*Thenameiswrong,pressagain!);search_school();}}search_item(){intx,sum=0,w=0;structstudents;printf(\nPleaseenterthenameoftheitemthatyouwanttosearch:);scanf(%s,&s.item);printf_face();for(x=0;xA;x++)if(strcmp(s.item,stu[x].item)==0){sum+=stu[x].mark;printf_one(x);w=1;}printf_sum(sum);if(w==0){printf(\n\n*Thenameiswrong,pressagain!);search_item();}}mark(intj,inti){intg;externp[15],q[15];if(j==1){if(stu[i].position==1)stu[i].mark=7;elseif(stu[i].position==2)stu[i].mark=5;elseif(stu[i].position==3)stu[i].mark=3;elseif(stu[i].position==4)stu[i].mark=2;elseif(stu[i].position==5)stu[i].mark=1;}if(j==2){if(stu[i].position==1)stu[i].mark=5;elseif(stu[i].position==2)stu[i].mark=3;elseif(stu[i].position==3)stu[i].mark=1;}if(j==3){for(g=0;g15;g++)if(stu[i].position==p[g])stu[i].mark=q[g];}}define_mark(){staticintp[15],q[15],a,b,j;for(a=0;a15;a++){printf(\nTheposition(1--15):);scanf(%d,&p[a]);printf(\nThemarkyouwanttodefine(Integral):);scanf(%d,&q[a]);loop:printf(\nDoyouwantdefinemore:\t1).Yes\t2).No);scanf(%d,&b);if(b==2)break;if(b!=1)gotoloop;}j=3;}printf_one(intx){printf(\n%-20s%-20s%-20s%-5c%-9d%-5d,stu[x].shool,stu[x].name,stu[x].item,stu[x].sex,stu[x].position,stu[x].mark);}printf_sum(intsum){printf(\n\nThesumofmarkis:\t%d,sum);printf(\nTheshoolnumberis:\t%d,N);printf(\nTheitemnumberis:\t%d\n,W+M);}printf_face(){printf(\n\nSchoolnamestudentnameitemsexpositionmark);}

1 / 5
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功