1、 C语言课程设计报告 运 动 会 分 数 统 计 系 统 学校 xxxx 班级:xxxx 姓名:xxx 学号:xxxxxxxxx 一.需求分析 1 问题描述 运动会分数统计系统 参加运动会有 n个系,系编号为 1n。比赛分成 m 个男子项目,和 w 个 女子项目。项目编号为男子 1m,女子 m+1m+w。不同的项目取前五名 或前三名积分;取前五名的积分分别为:7、5、3、2、1,前三名的积分分别为: 5、3、2;哪些取前五名或前三名由学生自己设定。 (mp-name; char c; while (mark!=1) coutboy=0; p-girl=0; p-next=head1-next;
2、 head1-next=p; coutnext; return i; void department_write()/将系数据写入文本 Department * p; p=head1; p=p-next; ofstream outfile(“Department.txt“,ios:out); outfilei; while(i0) Department * p; p=new Department; infilep-namep-numberp-boyp-girl; p-next=head1-next; head1-next=p; i-; coutboy)next; while(p) if(p-n
3、umber=a) return 1; p=p-next; return 0; void department_show(int a)/输出所有系 Department *p; p=head1; p=p-next; while(p) if(p-number=a) coutnumber=a) coutgirl)number=b) if(c=1) p-boy=p-boy+a; else p-girl=p-girl+a; p=p-next; void department_order(Department *temp,int type) /type=0 按总分,type=1 按男总 分,type=2
4、按女总分, Department *p,*q,*small,*temp1; temp1=new Department; temp1-next=NULL; p=temp; while(p) small=p; q=p-next; while(q) switch(type) case 0: if(q-boy+q-girl)girl+small-boy) small=q; break; case 1: if(q-boyboy) small=q; break; case 2: if(q-girlgirl) small=q; break; default: coutboy; p-boy=small-boy
5、; small-boy=temp1-boy; temp1-girl=p-girl; p-girl=small-girl; small-girl=temp1-girl; strcpy(temp1-name,p-name); strcpy(p-name,small-name); strcpy(small-name,temp1-name); temp1-number=p-number; p-number=small-number; small-number=temp1-number; /将系的名字互换 q=q-next; p=p-next; Sport * head2; int sport_isex
6、ist(int a) /检查运动项目(编号)是否已经存在 int b=0; Sport *p; p=head2; p=p-next; while(p) if(p-number=a) return 1; p=p-next; return 0; void sport_add() /添加项目 Sport * p; int mark=0; p=new Sport; coutname; char c; while (mark!=1) coutc; p-isboy=(int)(c-0);/字符转换成数字 if (!isdigit(c) cout1) coutc; p-is3=(int)(c-0); if (!isdigit(c) cout1) coutc; if (!isdigit(c) cout