c语言程序设计学校运动会管理系统,C++实现学校运动会管理系统

本文介绍了使用C++编程实现的学校运动会管理系统,包括比赛项目管理、运动员信息管理及比赛赛事记录等功能。系统提供了输入、输出、修改、删除和查询等操作,实现了对比赛项目、运动员和赛事数据的文件存储和读取。
摘要由CSDN通过智能技术生成

本文实例为大家分享了C++实现学校运动会管理系统的具体代码,供大家参考,具体内容如下

#include

#include

#include

using namespace std;

void fun1()

{ cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

cout<

}

class Match

{

public:

Match *next;//为创建链表做准备

int number; //比赛项目编号

char call[10]; //比赛项目名称

char time[10]; //比赛时间

char place[20]; //比赛地点

friend void input1();

};

void input1()

{ ofstream fout("e:\\比赛项目.dat",ios::app);

char ch;

Match a;

do

{ cout<

cin>>a.number>>a.call>>a.place>>a.time;

a.next=NULL;

fout.write((char *)&a,sizeof(Match));

cout<

cin>>ch;

}while(ch=='y'||ch=='Y');

fout.close();

}

Match *head1;

void creat()

{ head1=NULL;

Match *p,*q=head1;

ifstream fin("e:\\比赛项目.dat",ios::in);

if(!fin)

{ cout<

}

p=new Match;

fin.read((char*)p,sizeof(Match));

while(!fin.eof())

{ if(head1==NULL) head1=p;

else

q->next=p;

q=p;

p=new Match;

fin.read((char*)p,sizeof(Match));

}

fin.close();

}

int change1() //对比赛项目相关信息修改

{

cout<

creat();

Match *p1;

p1=head1;

cout<

int number1; //要修改的比赛项目编号

int sign=0; //设置的标记变量

cin>>number1;

while(p1!=NULL)

{ if(p1->number==number1) {sign=1;break;}

p1= p1->next;

}

if (sign==0)

cout<

else

{

cout<

cout<

cout<

cout<

cout<

cout<

int a;

int nu; //新的整形数据

char info[20]; //新的字符数组

cin>>a;

switch(a)

{

case 1:cout<

cin>>nu;

p1->number=nu;

cout<

break;

case 2:cout<

cin>>info;

strcpy(p1->call,info);

cout<

break;

case 3:cout<

cin>>info;

strcpy(p1->time,info);

cout<

break;

case 4:cout<

cin>>info;

strcpy(p1->place,info);

cout<

break;

}

ofstream fout("e:\\比赛项目.dat",ios::out);

p1=head1;

while(p1!=NULL)

{

fout.write((char*)p1,sizeof(Match));

p1=p1->next;

}

fout.close();

}

return 0;

}

int delete1() //对比赛项目相关信息进行删除

{ creat();

Match *p1,*p2;

p2=p1=head1;

cout<

cout<

cout<

cout<

int n;

cin>>n;

int num,flag=0;

char cal[10];

switch(n)

{case 1: cin>>num;

while(p1!=NULL)

{ if(p1->number==num) {flag=1;break;}

p2=p1;

p1= p1->next;

}

if (flag==0)

cout<

else

p2->next=p1->next;

case 2: cin>>cal;

while(p1!=NULL)

{ if(!strc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值