没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
数据结构课程设计报告书
数据结构课程设计报告书
课内设计任务一:
1.设计题目:运动会分数统计
2.任务:参加运动会有 n 个学校,学校编号为 1……n。比赛分成 m 个男子项目,
和 w 个女子项目。项目编号为男子 1~m,女子 m+1~m+w。不同的项目取前
五名或前三名积分;取前五名的积分分别为:7、5、3、2、1,前三名的积分分
别为:5、3、2;哪些项目取前五名或前三名由学生自己设定。(m<=20,n<=20)
3.功能要求:
1) 可以输入各个项目的前三名或前五名的成绩;
2) 能统计各学校总分;
3) 可以按学校编号、学校总分、男女团体总分排序输出;
4) 可以按学校编号查询学校某个项目的情况;
5) 可以按项目编号查询取得前三或前五名的学校。
需求分析:
本程序需要建立两个个线性表,一个计运动项目,一个计学校,项目信息中
记录了前几名,通过遍历项目表可以统计出每个学校的成绩,统计出成绩记录
在学校数组中,最后算出男子,女子和总体的总分,并以此排序。
概要设计:
typedef struct school
{
char name[60];
int id;
int male_score;
int female_score;
}School, * School_List;
typedef struct sport
{
char name[60];
int id;
int category;
int winner[5];
}Sport, * Sport_List;
School_List scl;
Sport_List spl;
详细设计:
# include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
typedef struct school
{
char name[60];
int id;
int male_score;
int female_score;
}School, * School_List;
typedef struct sport
{
char name[60];
int id;
//类别(积分类型 1:75321;0:532)
int category;
int winner[5];
}Sport, * Sport_List;
//统计每个学校的分数
void count_score(int m, int n, int w, School_List
scl,Sport_List spl)
{
int i = 0;
//初始化分数为 0
for(i;i<n;i++)
{
scl[i].male_score = 0;
scl[i].female_score = 0;
}
//统计男子项目
for(i=0;i<m;i++)
{
if(spl[i].category == 1)
{
scl[spl[i].winner[0]-1].male_score
+= 7;
scl[spl[i].winner[1]-1].male_score
+= 5;
scl[spl[i].winner[2]-1].male_score
+= 3;
scl[spl[i].winner[3]-1].male_score
+= 2;
scl[spl[i].winner[4]-1].male_score
+= 1;
}
else
{
scl[spl[i].winner[0]-1].male_score
剩余32页未读,继续阅读
资源评论
G11176593
- 粉丝: 6677
- 资源: 3万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功