【www.arisingsemi.com--IT认证】

3th
“校际运动会" 管理系统
一.题目要求
设计校际运动会管理系统,实现学校、运动员信息和运动项目的录入,比赛结果的输入,各个学校比赛结果的查询,生成团体总分报表,查看参赛学校信息和比赛项目信息。要求功能选择用菜单实现。
二. 需求分析
根据题目要求应提供键盘式菜单实现功能选择,还应提供信息的输入操作,由于在程序中提供查询功能所以应有显示、查找等操作。

一、总体设计
根据上面的需求分析,可以将这个系统的设计分为

1、信息输入模块

2、比赛结果录入模块

3、查询模块。
具体校际运动会管理系统分为 信息的输入、结果的输入、学校各个项目的得分的查寻、总体报表的生成。

二、详细设计


1、 主函数
主函数一般设计的比较简洁,只提供输入,处理和输出部分的函数调用。其中功能模块用菜单方式选择。
流程图

[程序]
main()
{
menu();/*menu 是菜单函数*/
}
菜单函数程序如下:
menu()
{ int o,n;
do
{ puts("\t\t*****************MENU********************");
puts("\n\n\t\t  information to writein\n");
puts("\t\t  race result records to writein\n");
puts("\t\t  the information\n");
puts("\t\t  \n");
puts("\n\t\t*****************************************");
puts("\n\nChoice 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、 信息输入
[数据结构]
数据结构采用结构体的形式,包括学校、项目、运动员三个结构体。
比如学校结构体成员包括学校校名、竞赛项目、得分;项目结构体成员包括项目名、权值。
struct student
{ char shool[10];
char name[10];
char item[10];
char sex;
int position;
int mark;
}stu[C];        /*stu[N]中每个数组元素对应一个学生*/
struct item
{ char name[10];
char sex;
int mark;
}it[C];        /*it[C]中每个数组元素对应一个项目*/
struct shool
{ char name[10];
char item[10];
int mark;
}sho[C]    /* sho[C]每个数组元素对应一个学校;*/   
[信息输入模块]
根据题意把与运动员的学校、名字、项目、性别、名次、分数作为结构体成员,如果要存放若干个运动员的信息就用结构体数组。

struct student
{ char shool[10];
char name[10];
char item[10];
char sex;
int position;
int mark;
}stu[C];      /*stu[C]中每个数组元素对应一个运动员*/
stu[C]中的C为运动员的个数,程序中采用宏定义的方式定义C=100,C的值可随时在源程序中改变。









图2 输入模块流程图
/******************输入模块*****************/
writein()                /*输入模块*/
{ int t,r,i=0;extern j;char F,M;y=1;
printf("\nPlease writein the student"s name:\t");scanf("%s",&stu[i].name);    /*输入名字*/
printf("\nPlease writein  the student"s shool:\t");scanf("%s",&stu[i].shool);  /*输入学校*/
printf("\nPlease writein  the student"s item:\t");scanf("%s",&stu[i].item);    /*输入项目*/
loop_
1: printf("\nPlease writein  the student"s sex(W or M):\t");scanf("%s",&stu[i].sex); /*输入性别*/
if(stu[i].sex。
="W"&&stu[i].sex。="M")goto loop_1;                /*选择函数*/
printf("\nPleasewritein  the student"s position:\t");scanf("%d",&stu[i].position);
mark(j,i);
loop_
2:printf("\n\nDo again?\t1).Yes\t2).No\t");
scanf("%d",&t);
if(t。=2&&t。=1)goto loop_2;                                /*调用goto结构*/
if(t==2)menu();
i++;
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。
。\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 number of women item is:");
scanf("%d",&W);              /****输入学校的代号、男女运动项目的代号****/
printf("\nThere are three form of marked you can choice:");
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).Define by youself.");      /*****用户自定义********/
loop: printf("\n\nChoice the number(1--3):");
scanf("%d",&h);
if(h>0&&h

本文来源:http://www.arisingsemi.com/it/55391/