学校运动会管理系统

上传人:沈*** 文档编号:127991817 上传时间:2022-07-31 格式:DOC 页数:19 大小:78.52KB
收藏 版权申诉 举报 下载
学校运动会管理系统_第1页
第1页 / 共19页
学校运动会管理系统_第2页
第2页 / 共19页
学校运动会管理系统_第3页
第3页 / 共19页
资源描述:

《学校运动会管理系统》由会员分享,可在线阅读,更多相关《学校运动会管理系统(19页珍藏版)》请在装配图网上搜索。

1、一、 题目要求设计校际运动会管理系统,实现学校、运动员信息和运动项目的录入,比赛结果的输入,各个学校比赛结果的查询,生成团体总分报表,查看参赛学校信息和比赛项目信息。要求功能选择用菜单实现。二、 需求分析 根据题目要求应提供键盘式菜单实现功能选择,还应提供信息的输入操作,由于在程序中提供查询功能所以应有显示、查找等操作。三、 总体设计根据上面的需求分析,可以将这个系统的设计分为1、信息输入模块 2、比赛结果录入模块 3、查询模块。具体校际运动会管理系统分为 信息的输入、结果的输入、学校各个项目的得分的查寻、总体报表的生成。四、 详细设计 1、 主函数 主函数一般设计的比较简洁,只提供输入,处理

2、和输出部分的函数调用。其中功能模块用菜单方式选择。流程图显示一系列功能选项 N输入n,判断n是否是09 Y根据n的值调用各功能模块函数程序main()menu();/*menu 是菜单函数*/菜单函数程序如下: menu() int o,n; do puts(tt*MENU*); puts(nntt 1.The information to writeinn); puts(tt 2.The race result records to writeinn); puts(tt 3.Search the informationn); puts(tt 4.Exitn); puts(ntt*); put

3、s(nnChoice you number:); scanf(%d,&n); if(n4)o=1;getchar(); /*对选择的数字进行判断*/ else o=0; while(o=1); /*选择功能*/ switch(n) case 1:writein();break; /*信息输入模块*/ case 2:resultin();break; /*比赛结果输入模块*/ case 3:search();break; /*查询模块*/ case 4:exit(0); /*退出*/ 各个模块的设计1、 信息输入 数据结构数据结构采用结构体的形式,包括学校、项目、运动员三个结构体。比如学校结构体

4、成员包括学校校名、竞赛项目、得分;项目结构体成员包括项目名、权值。struct student char shool10; char name10; char item10; char sex; int position; int mark;stuC; /*stuN中每个数组元素对应一个学生*/struct item char name10; char sex; int mark;itC; /*itC中每个数组元素对应一个项目*/struct shool char name10; char item10; int mark;shoC /* shoC每个数组元素对应一个学校;*/ 信息输入模块

5、根据题意把与运动员的学校、名字、项目、性别、名次、分数作为结构体成员,如果要存放若干个运动员的信息就用结构体数组。 struct student char shool10; char name10; char item10; char sex; int position; int mark;stuC; /*stuC中每个数组元素对应一个运动员*/ stuC中的C为运动员的个数,程序中采用宏定义的方式定义C=100,C的值可随时在源程序中改变。 输入运动员的学校、名字、项目、性别输入运动员的名次并进入选择模式if(t=2) 返回主函数图2 输入模块流程图/*输入模块*/writein() /*输

6、入模块*/ int t,r,i=0;extern j;char F,M;y=1; printf(nPlease writein the students name:t);scanf(%s,&stui.name); /*输入名字*/ printf(nPlease writein the students shool:t);scanf(%s,&stui.shool); /*输入学校*/ printf(nPlease writein the students item:t);scanf(%s,&stui.item); /*输入项目*/loop_1: printf(nPlease writein th

7、e students sex(W or M):t);scanf(%s,&stui.sex); /*输入性别*/ if(stui.sex!=W&stui.sex!=M)goto loop_1; /*选择函数*/ printf(nPleasewritein the students position:t);scanf(%d,&stui.position); mark(j,i);loop_2:printf(nnDo again?t1).Yest2).Not); scanf(%d,&t); if(t!=2&t!=1)goto loop_2; /*调用goto结构*/ if(t=2)menu(); i+

8、; if(t=1);f=1; printf(Success!nPress any key+enter to menu.);scanf(%d,&r); /*返回主函数*/ menu();结果录入模块 该模块的功能是输入男女运动员的成绩,并由用户选择或定义各名次的分数。 流程图 提醒用户先输入运动员信息输入学校的代号、男女运动项目的代号用户选择或定义各名次的分数输入成绩并反回主函数程序 /*结果录入模块*/ resultin() /*结果录入模块*/ int h,r; extern N,M,W,y; if(y=0) printf(Please establish system first!nPre

9、ss any key +enter to menu. ); scanf(%d,&r); /*提醒用户输入运动员的基本信息*/ menu(); printf(nThe number of shool attended is:); scanf(%d,&N); printf(nThe number of men item is:); scanf(%d,&M); printf(nThe number of women item is:); scanf(%d,&W); /*输入学校的代号、男女运动项目的代号*/ printf(nThere are three form of marked you can

10、 choice:); printf(nnt1).1th-7,2th-5,3th-3,4th-2,5th-1.); printf(nnt2).1th-5,2th-3,3th-1.); printf(nnt3).Define by youself.); /*用户自定义*/loop: printf(nnChoice the number(1-3):); scanf(%d,&h); if(h0&h4|e1)goto loop; printf(Press any key+enter to menu.);scanf(%s,&c);menu();search_school() /*学校查询程序*/ int

11、x,sum=0,w=0; struct student s; printf(nPlease enter the name of the school that you want to search:); scanf(%s,&s.shool); printf_face(); for(x=0;xC;x+) if(strcmp(s.shool,stux.shool)=0) /*调用stu结构体*/ sum+=stux.mark; printf_one(x);w=1; /*读出结构体的数据*/ printf_sum(sum); if(w=0) printf(nn*The name is wrong,p

12、ress again!);search_school();search_item() /*项目查询程序*/ int x,sum=0,w=0; struct student s; printf(nPlease enter the name of the item that you want to search:); scanf(%s,&s.item); printf_face(); /*数据输入*/ for(x=0;xC;x+) if(strcmp(s.item,stux.item)=0) / *调用stu数组*/ sum+=stux.mark; printf_one(x);w=1; print

13、f_sum(sum); /*数据输出*/ if(w=0) printf(nn*The name is wrong,press again!);search_item();程序中调用的函数 记分的函数即用来确定不同的名次所得的不同分数。 mark(int j,int i) int g; extern p15,q15; if(j=1) if(stui.position=1)stui.mark=7; else if(stui.position=2)stui.mark=5; else if(stui.position=3)stui.mark=3; else if(stui.position=4)stu

14、i.mark=2; else if(stui.position=5)stui.mark=1; if(j=2) if(stui.position=1)stui.mark=5; else if(stui.position=2)stui.mark=3; else if(stui.position=3)stui.mark=1; if(j=3) for(g=0;g15;g+)if(stui.position=pg)stui.mark=qg;define_mark() /*自定义名次分数的子函数*/ static int p15,q15,a,b,j; for(a=0;a15;a+) printf(nThe

15、 position(1-15):);scanf(%d,&pa); printf(nThe mark you want to define(Integral):);scanf(%d,&qa);/*自定义*/ loop:printf(nDo you want define more:t1).Yest2).No);scanf(%d,&b); if(b=2)break; if(b!=1)goto loop; j=3;printf_one(int x) /*运动员个人信息的输出函数*/ printf(n%-20s%-20s%-20s%-5c%-9d%-5d,stux.shool,stux.name,st

16、ux.item,stux.sex,stux.position,stux.mark);printf_sum(int sum) /*团体成绩的输出函数*/ printf(nnThe sum of mark is:t %d,sum); printf(nThe shool number is: t%d,N); printf(nThe item number is: t%dn,W+M);printf_face() /*学校成绩输出函数*/ printf(nnSchool name student name item sex position mark);原程序 #include#define C 100

17、int y=0,f=0,j,W,M,N,p15,q15;struct student char shool10; char name10; char item10; char sex; int position; int mark;stuC;struct item char name10; char sex; int mark;itC;struct shool char name10; char item10; int mark;shoC;main() menu();menu() int o,n; do puts(tt*MENU*); puts(nntt 1.The information t

18、o writeinn); puts(tt 2.The race result records to writeinn); puts(tt 3.Search the informationn); puts(tt 4.Exitn); puts(ntt*); puts(nnChoice you number:); scanf(%d,&n); if(n4)o=1;getchar(); else o=0; while(o=1); switch(n) case 1:writein();break; case 2:resultin();break; case 3:search();break; case 4

19、:exit(0); writein() int t,r,i=0;extern j;char F,M;y=1; printf(nPlease writein the students name:t);scanf(%s,&stui.name); printf(nPlease writein the students shool:t);scanf(%s,&stui.shool); printf(nPlease writein the students item:t);scanf(%s,&stui.item);loop_1: printf(nPlease writein the students se

20、x(W or M):t);scanf(%s,&stui.sex); if(stui.sex!=W&stui.sex!=M)goto loop_1; printf(nPleasewritein the students position:t);scanf(%d,&stui.position); mark(j,i);loop_2:printf(nnDo again?t1).Yest2).Not); scanf(%d,&t); if(t!=2&t!=1)goto loop_2; if(t=2)menu(); i+; if(t=1);f=1; printf(Success!nPress any key

21、+enter to menu.);scanf(%d,&r); menu();resultin() int h,r; extern N,M,W,y; if(y=0) printf(Please establish system first!nPress any key +enter to menu. ); scanf(%d,&r); menu(); printf(nThe number of shool attended is:); scanf(%d,&N); printf(nThe number of men item is:); scanf(%d,&M); printf(nThe numbe

22、r of women item is:); scanf(%d,&W); printf(nThere are three form of marked you can choice:); printf(nnt1).1th-7,2th-5,3th-3,4th-2,5th-1.); printf(nnt2).1th-5,2th-3,3th-1.); printf(nnt3).Define by youself.);loop: printf(nnChoice the number(1-3):); scanf(%d,&h); if(h0&h4|e1)goto loop; printf(Press any

23、 key+enter to menu.);scanf(%s,&c);menu();search_school() int x,sum=0,w=0; struct student s; printf(nPlease enter the name of the school that you want to search:); scanf(%s,&s.shool); printf_face(); for(x=0;xC;x+) if(strcmp(s.shool,stux.shool)=0) sum+=stux.mark; printf_one(x);w=1; printf_sum(sum); if

24、(w=0) printf(nn*The name is wrong,press again!);search_school();search_item() int x,sum=0,w=0; struct student s; printf(nPlease enter the name of the item that you want to search:); scanf(%s,&s.item); printf_face(); for(x=0;xC;x+) if(strcmp(s.item,stux.item)=0) sum+=stux.mark; printf_one(x);w=1; pri

25、ntf_sum(sum); if(w=0) printf(nn*The name is wrong,press again!);search_item();mark(int j,int i) int g; extern p15,q15; if(j=1) if(stui.position=1)stui.mark=7; else if(stui.position=2)stui.mark=5; else if(stui.position=3)stui.mark=3; else if(stui.position=4)stui.mark=2; else if(stui.position=5)stui.m

26、ark=1; if(j=2) if(stui.position=1)stui.mark=5; else if(stui.position=2)stui.mark=3; else if(stui.position=3)stui.mark=1; if(j=3) for(g=0;g15;g+)if(stui.position=pg)stui.mark=qg;define_mark() static int p15,q15,a,b,j; for(a=0;a15;a+) printf(nThe position(1-15):);scanf(%d,&pa); printf(nThe mark you wa

27、nt to define(Integral):);scanf(%d,&qa); loop:printf(nDo you want define more:t1).Yest2).No);scanf(%d,&b); if(b=2)break; if(b!=1)goto loop; j=3;printf_one(int x) printf(n%-20s%-20s%-20s%-5c%-9d%-5d,stux.shool,stux.name,stux.item,stux.sex,stux.position,stux.mark);printf_sum(int sum) printf(nnThe sum o

28、f mark is:t %d,sum); printf(nThe shool number is: t%d,N); printf(nThe item number is: t%dn,W+M);printf_face() printf(nnSchool name student name item sex position mark);主函数菜单信息输入模块结果录入模块查询模块总结:通过此次C语言课程设计实习,我收获颇多。以前只是为了考试去学习,而这次实习是将所学知识运用到实际中。此次实习中,我成功做出了这道题:建立校际运动会管理系统的文件题。本题看起来很烦琐,但理清思路后,就很简单了,一定程度

29、上来说,复杂性决定了程序的使用性和功能性较高。指导书中有关文件的题目差不多都大同小异,只要一题会做,其他题目也就迎刃而解,只要将各功能模块融会贯通并加以适当调整即可,但前提还是必须对指导书里的例题熟练掌握。然而,这同时又成为了指导书的一个弊端,我相信有关文件题目的多样化会更能提高学生的编程能力。因为题目较简单,完全可以独立编程,但程序的先进性还有待进一步提高。程序的简单性和题目的局限性从而也决定了程序的实用性和功能性较差,在编程过程中还是应该特别注意充分理解题目要求和各循环语句的充分调用和理解。我知道,这只是一个小小的开端,以后的路还很长,还要继续坚持下去,才能具备一定的编程能力。附:源代码#

30、include#define A 100int y=0,f=0,j,W,M,N,p15,q15;struct student char shool20; char name20; char item20; char sex; int position; int mark;stuA;struct item char name20; char sex; int mark;itA;struct shool char name20; char item20; int mark;shoA;main() menu();menu() int w1,n; do puts(tt*MENU*); puts(nnt

31、t 1.The information to writeinn); puts(tt 2.The race result records to writeinn); puts(tt 3.Search the informationn); puts(tt 4.Exitn); puts(ntt*); puts(nnChoice you number:); scanf(%d,&n); if(n4)w1=1;getchar(); else w1=0; while(w1=1); switch(n) case 1:establish();break; case 2:enter();break; case 3

32、:search();break; case 4:exit(0); establish() int h,r; extern N,M,W; y=1; printf(nThe number of shool attended is:); scanf(%d,&N); printf(nThe number of men item is:); scanf(%d,&M); printf(nThe number of women item is:); scanf(%d,&W); printf(nThere are three form of marked you can choice:); printf(nn

33、t1).1th-7,2th-5,3th-3,4th-2,5th-1.); printf(nnt2).1th-5,2th-3,3th-1.); printf(nnt3).Define by youself.);loop: printf(nnChoice the number(1-3):); scanf(%d,&h); if(h0&h4|e1)goto loop; printf(Press any key+Enter to menu.);scanf(%s,&c);menu();search_school() int x,sum=0,w=0; struct student s; printf(nPl

34、ease enter the name of the school that you want to search:); scanf(%s,&s.shool); printf_face(); for(x=0;xA;x+) if(strcmp(s.shool,stux.shool)=0) sum+=stux.mark; printf_one(x);w=1; printf_sum(sum); if(w=0) printf(nn*The name is wrong,press again!);search_school();search_item() int x,sum=0,w=0; struct

35、student s; printf(nPlease enter the name of the item that you want to search:); scanf(%s,&s.item); printf_face(); for(x=0;xA;x+) if(strcmp(s.item,stux.item)=0) sum+=stux.mark; printf_one(x);w=1; printf_sum(sum); if(w=0) printf(nn*The name is wrong,press again!);search_item();mark(int j,int i) int g;

36、 extern p15,q15; if(j=1) if(stui.position=1)stui.mark=7; else if(stui.position=2)stui.mark=5; else if(stui.position=3)stui.mark=3; else if(stui.position=4)stui.mark=2; else if(stui.position=5)stui.mark=1; if(j=2) if(stui.position=1)stui.mark=5; else if(stui.position=2)stui.mark=3; else if(stui.posit

37、ion=3)stui.mark=1; if(j=3) for(g=0;g15;g+)if(stui.position=pg)stui.mark=qg;define_mark() static int p15,q15,a,b,j; for(a=0;a15;a+) printf(nThe position(1-15):);scanf(%d,&pa); printf(nThe mark you want to define(Integral):);scanf(%d,&qa); loop:printf(nDo you want define more:t1).Yest2).No);scanf(%d,&

38、b); if(b=2)break; if(b!=1)goto loop; j=3;printf_one(int x) printf(n%-20s%-20s%-20s%-5c%-9d%-5d,stux.shool,stux.name,stux.item,stux.sex,stux.position,stux.mark);printf_sum(int sum) printf(nnThe sum of mark is:t %d,sum); printf(nThe shool number is: t%d,N); printf(nThe item number is: t%dn,W+M);printf_face() printf(nnSchool name student name item sex position mark);

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!