运动会分数统计程序Word格式文档下载.docx
- 文档编号:19850049
- 上传时间:2023-01-10
- 格式:DOCX
- 页数:23
- 大小:89.88KB
运动会分数统计程序Word格式文档下载.docx
《运动会分数统计程序Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《运动会分数统计程序Word格式文档下载.docx(23页珍藏版)》请在冰豆网上搜索。
前三名,前五名,第一名系编号,第二名系编号,第三名系编号,第四名系编号,第五名系编号。
院系类
Dname
Name
Number
Sex
classDname{//院系
private:
charname[20];
intnumber;
intboy;
intgirl;
public:
Dname*next;
voidDname_add();
voidDname_output(Dname*p);
intDname_isexist(inta);
voidDname_show(inta);
voidDname_search(inta);
voidDname_addmark(inta,intb,intc);
voidDname_order(Dname*temp,inttype);
};
运动项目类;
sport
name
number
排名
classSport//运动项目
{
intisboy;
//0为女项目?
1为男项目
intis3;
//0为取前五名,1为取前五名
//项目编号
intfirst;
//
intsecond;
intthird;
intfourth;
intfifth;
Sport*next;
intSport_isexist(inta);
voidSport_add();
voidSport_output(Sport*p);
voidSport_search(inta);
三、程序编码:
#include<
iostream>
iomanip>
string>
usingnamespacestd;
classSport//运?
动¡
¥
项?
目?
//0为女项目1为男项目?
//为取前五名为取前五名?
//项?
编À
¨
¤
号?
Dname*head1;
Sport*head2;
voidDname:
:
Dname_add()
Dname*p;
intmark=0;
p=newDname;
cout<
<
"
请输入院系的名称:
;
cin>
>
p->
name;
intc;
while(mark!
=1)
{
请输入院系编号:
c;
p->
number=c;
mark=1;
boy=0;
girl=0;
next=head1->
next;
head1->
next=p;
成功添加了一个院系"
endl;
是否还要添加院¦
y/n)"
charinput,y,n;
input;
switch(input)
case'
y'
mark=0;
Dname_add();
n'
return;
}
deletep;
}
Dname_output(Dname*p){//输出系
当前院系(名称)编号男团总分女团总分 总分t\n"
p=head1;
p=p->
while(p){
cout<
name<
\t\t"
number<
\t"
boy<
girl<
\t"
(p->
girl+p->
boy)<
p=p->
intDname:
Dname_isexist(inta)
intb=0;
while(p)
if(p->
number==a)
return1;
return0;
Dname_show(inta)//输出所有院系
Dname*p;
?
无T"
Dname_search(inta)
院系名称:
"
男子团体总分:
<
女子团体总分:
总分:
boy+p->
girl)<
无T此ä
?
Dname_addmark(inta,intb,intc)女?
number==b)
if(c==1)
boy=p->
boy+a;
else
girl=p->
girl+a;
Dname_order(Dname*temp,inttype)
Dname*q,*small;
Dname*temp1;
temp1=newDname;
temp1->
next=NULL;
while(q&
&
small)
switch(type)
case0:
//按总分排序
for(q=head1;
q=q->
q!
=NULL)
for(small=head1;
small=small->
small!
if((q->
boy+q->
(small->
boy+small->
girl))
girl=q->
girl;
q->
girl=small->
small->
girl=temp1->
boy=q->
boy;
boy=small->
boy=temp1->
strcpy(temp1->
name,q->
name);
strcpy(q->
name,small->
strcpy(small->
name,temp1->
number=q->
number;
number=small->
number=temp1->
break;
case1:
//按男团体排序
if(q->
small->
boy)
case2:
girl)
case3:
number)
default:
error"
intSport:
Sport_isexist(inta)
Sport*p;
p=head2;
voidSport:
Sport_add()
//Dnamesh;
p=newSport;
请?
输º
入¨
名?
称?
if(Sport_isexist(c))
该?
已°
存ä
在¨
²
!
类¤
型¨
ª
(0为a女?
子Á
®
1为a男D子Á
):
//p->
isboy=(int)(c-'
0'
);
//去¨
£
掉Ì
了¢
字Á
符¤
转Á
a换?
成¨
¦
数º
y字Á
isboy=c;
请输入项目名称情况(0为取前3名,1为取前5名):
is3=(int)(c-'
is3=c;
Dnamesh;
请输入第一名院系的编号:
if(!
sh.Dname_isexist(c))
该院系不存在请先添加!
}
first=c;
is3=='
)
sh.Dname_addmark(5,c,p->
isboy);
sh.Dname_addmark(7,c,p->
请输入第二名院系的编号?
second=c;
sh.Dname_addmark(3,c,p->
请输入第三名院系的编号:
该院系不存在请先添加"
third=c;
sh.Dname_addmark(2,c,p->
1'
请输入第四名院系的编号:
fourth=c;
请输入第五名院系的编号:
fifth=c;
sh.Dname_addmark(1,c,p->
fourth='
fifth='
next=head2->
head2->
成功添加了一个运动项目"
Sport_output(Sport*p)//输º
出?
的Ì
情¨
况?
当前项目名称"
编号?
"
B/G"
3/5"
第一名"
第二名"
第三名"
第四名"
第五名"
"
isboy<
is3<
"
sh.Dname_show(p->
first);
second);
third);
fourth);
fifth);
\n"
Sport_search(inta)//搜?
索¡
Â
Sport*p;
项目名:
endl<
项目类型:
isboy==1)
男子项目"
女子项目"
第一名:
第二名:
第三名:
第四名:
第五?
无此编号"
voidmain(){//运动会程序主函数
system("
colorC"
//改变背景前景色
head1=newDname;
head2=newSport;
//Dname_add();
Sportsp;
Dname*p1;
Sport*p2;
p1=head1;
p1=p1->
p2=head2;
p2=p2->
intchoose;
chartemp;
inta=1;
while(a!
=0)
"
欢迎使用运动会分数统计系统"
----------------------------------------------------------"
1.输入院系;
2.输入运动项目"
3.按院系编号输出总分;
4.按院系总分排序;
5.按男团体总分排序;
6.按女团体总分排序;
7.按院系编号查询;
8.按项目编号查询;
0.退出"
注输入运动项目之前请输入院系"
-------请选择(0-8):
------"
choose;
switch(choose)
sh.Dname_add();
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 运动会 分数 统计 程序