c++实现的运动会计分系统。。。。。
(1)可以输入各个项目的前三名或前五名的成绩;
(2)能统计各系总分;
(3)可以按系编号、系总分、男女团体总分排序输出;
(4)可以按系编号查询学校某个项目的情况;可以按项目编号查询取得前三或前五名的系。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 204 2009-06-28 09:35 运动会计分系统a.txt
文件 229 2009-06-28 11:37 运动会计分系统.txt
文件 295936 2009-06-28 11:37 运动会计分系统Debugsports meeting.bsc
文件 589925 2009-06-28 11:39 运动会计分系统Debugsports meeting.exe
文件 834576 2009-06-28 11:39 运动会计分系统Debugsports meeting.ilk
文件 392569 2009-06-28 11:39 运动会计分系统Debugsports meeting.obj
文件 1997944 2009-06-28 11:39 运动会计分系统Debugsports meeting.pch
文件 1156096 2009-06-28 11:39 运动会计分系统Debugsports meeting.pdb
文件 0 2009-06-28 11:37 运动会计分系统Debugsports meeting.sbr
文件 99328 2009-06-28 11:39 运动会计分系统Debugvc60.idb
文件 118784 2009-06-28 11:39 运动会计分系统Debugvc60.pdb
文件 10317 2009-06-28 11:39 运动会计分系统sports meeting.cpp
文件 3499 2009-06-28 11:39 运动会计分系统sports meeting.dsp
文件 553 2009-06-28 11:39 运动会计分系统sports meeting.dsw
文件 50176 2009-06-28 11:39 运动会计分系统sports meeting.ncb
文件 48640 2009-06-28 11:39 运动会计分系统sports meeting.opt
文件 788 2009-06-28 11:39 运动会计分系统sports meeting.plg
文件 325632 2009-06-28 11:38 运动会计分系统运动会.doc
文件 6323 2009-06-28 11:39 运动会计分系统运动会.txt
目录 0 2009-06-28 11:40 运动会计分系统Debug
目录 0 2009-07-14 13:56 运动会计分系统
----------- --------- ---------- ----- ----
5931519 21
//copyright to ZhangLei
#include
using namespace std;
#include
#include
#define si 15 //项目总数
#define man 10 //男子项目数
#define woman 5 //女子项目数
ifstream fin(“a.txt“);
ofstream fout(“运动会.txt“);
//itemnum为运动会项目总数
int itemnum=0; //输入的项目总数
typedef struct item
{
item();
item(int tol);
int itemNum; //itemNum为项目编号
int * college; //college为系编号
string * stuname; //stuname为运动员姓名
int * StudentScore; //StudentScore为运动员成绩
item * NextItem;
int total; //total为项目登记的人数
}item*Node;
struct score
{
int point; //point为系总得分
int num; //num为系编号
int manpoint; //manpoint为男子总得分
int womanpoint; //womanpoint为女子总得分
void operator=(const score &original); //重载运算符
};
item::item( )
{
NextItem=NULL;
}
item::item(int tol)
{
college=new int[tol];
stuname=new string[tol];
StudentScore=new int[tol];
NextItem=NULL;
}
void score::operator =(const score &original)
{
//score new_score={0};
num=original.num;
manpoint=original.manpoint;
point=original.point;
womanpoint=original.womanpoint;
//return new_score;
}
Node lastitem;
//////////////输入各个项目的成绩/////////////////////////////////
bool input(Node &head)
{
fout<<“***************项目成绩输入*****************“< int i;
Node newitem;
int val=0;
fout<<“请输入项目人数“< fin>>val;
newitem=new item(val);
if(!newitem) return false;
fout<<“请输入该项目的编号:“;
fin>>newitem->itemNum;
fout< newitem->total=val;
for(i=0;i {
fout<<“请输入第“< fin>>newitem->stuname[i];
fout<<“请输入运动员系编号:“;
fin>>newitem->college[i];
fout<<“请输入运动员分数:“;
fin>>newitem->StudentScore[i];
fout< }
//若头节点为空,新节点做表头
if(head==NULL) {
head=newitem;
lastitem=head;
}
//否则加入表尾
else
{
lastitem->NextItem=newitem;
lastitem=newitem;
}
itemnum++;
fout<<“这个项目输入完毕!“< return true;
}
//////////////////////按项目编号查询某个项目前几名的系的情况//////////////////////////////////
bool ItemSort(Node headint ItemName)
{
fout<<“项目编号“<<“ “<<“名次 “<<“ 姓名 “<<“ 系 “<<“ 积分 “< Node p;
//若链表不为空,对链表进行搜索
if(itemnum!=0)
{
p=head;
int j=0;
for(int i=1;i<=itemnum;i++)
{
if(p->itemNum==ItemName)
{
j=1;
for(int m=1;mtotal+1;m++)
{
fout<stuname[m-1]
<<“ “<college[m-1]<<“ “
<StudentScore[m-1]< }
break;
}
else
p=p->NextItem;
}
if(j==0)
fout<<“没有此项目的相关信息“< fout<<“********************************************“< }
else
fout<<“还没有输入数据,请先进行输入操作!“< return true;
}
//////////////////////用户给出系编号,显示该系得分
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 204 2009-06-28 09:35 运动会计分系统a.txt
文件 229 2009-06-28 11:37 运动会计分系统.txt
文件 295936 2009-06-28 11:37 运动会计分系统Debugsports meeting.bsc
文件 589925 2009-06-28 11:39 运动会计分系统Debugsports meeting.exe
文件 834576 2009-06-28 11:39 运动会计分系统Debugsports meeting.ilk
文件 392569 2009-06-28 11:39 运动会计分系统Debugsports meeting.obj
文件 1997944 2009-06-28 11:39 运动会计分系统Debugsports meeting.pch
文件 1156096 2009-06-28 11:39 运动会计分系统Debugsports meeting.pdb
文件 0 2009-06-28 11:37 运动会计分系统Debugsports meeting.sbr
文件 99328 2009-06-28 11:39 运动会计分系统Debugvc60.idb
文件 118784 2009-06-28 11:39 运动会计分系统Debugvc60.pdb
文件 10317 2009-06-28 11:39 运动会计分系统sports meeting.cpp
文件 3499 2009-06-28 11:39 运动会计分系统sports meeting.dsp
文件 553 2009-06-28 11:39 运动会计分系统sports meeting.dsw
文件 50176 2009-06-28 11:39 运动会计分系统sports meeting.ncb
文件 48640 2009-06-28 11:39 运动会计分系统sports meeting.opt
文件 788 2009-06-28 11:39 运动会计分系统sports meeting.plg
文件 325632 2009-06-28 11:38 运动会计分系统运动会.doc
文件 6323 2009-06-28 11:39 运动会计分系统运动会.txt
目录 0 2009-06-28 11:40 运动会计分系统Debug
目录 0 2009-07-14 13:56 运动会计分系统
----------- --------- ---------- ----- ----
5931519 21
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)