c++写足球管理系统

img


这个是一些具体的要求,尽快一点儿,可以的话明天之内也就是11号之前,谢谢。

需求不少,需要C++啊,要用类呗?

可以的

如有帮助,望采纳,我写了快两小时了,兄弟

1、C++设计 :足球俱乐部球员管理系统
程序设计说明:能够输入球员信息,插入球员信息,删除球员信息,
修改球员信息,查询球员信息,统计球员信息,还可以在屏幕上输出全部球员纪录。
程序的组成模块及每个模块的基本功能本程序包括:一个main函数和7个子函数.main函数的功能是根据不同的条件调用不同的子函数来完成一定的功能;子函数inp

2、ut()是输入球员信息;
setin()子函数用来插入球员信息;
delate()子函数是删除球员信息;
correct()子函数是修改球员信息;
search()子函数是查询球员信息,
tongji()是统计球员信息,
display()子函数是用来显示教工信息 

3. 程序的使用方法运行本程序时,会出现一个菜单,您可以根据自己的需求输入相应的数字,然后按回车键;
就可以根据提示对程序进行简单操作了.

4.程序的代码
#include <iostream> 
#include <string>
#include <iomanip>
#include <fstream>
/输入输出文件流类,如果是IF则是输入文件流类
using namespace std;
struct hy {
string xh;
string yhm;
char xb2;
int nl;
char zhy18;
float zj;
char sj20;
struct hy *next;
int input();
int setin();
int delate(); 
int correct();
int search();
int tongji();
int display();
int main(){
int i;
string z;
for(i=0;i++){cout<<"欢迎您进入足球俱乐部球员管理系统"<<endl;
cout<<""<<endl;
cout<<" (By angelfish 2007 07 03)"<< endl;
cout<<""<<endl;
cout<<" 您可以操作的如下:"<<endl;
cout<<""<<endl;
cout<<" -------------"<<endl;
cout<<" 1.输入球员信息"<<endl;
cout<<" 2.插入球员信息"<<endl;
cout<<" 3.删除球员信息"<<endl;
cout<<" 4.修改球员信息"<<endl;
cout<<" 5.查询球员信息"<<endl;
cout<<" 6.统计球员信息"<<endl;
cout<<" 7.显示球员信息"<<endl;
cout<<" 8.退出管理系统"<<endl;
cout<<" ---------------"<<endl;
cout<<""<<endl;
cout<<" 请输入您的选择:"<<endl;
cout>>z;
if(z=="1") input();
else if(z=="2")setin();
else if(z=="3")delate();
else if(z=="4")correct();
else if(z=="5")search();
else if(z=="6")tongji();
else if(z=="7")display();
else if(z=="8")break;
else cout<<"您的选择有误,请您按序号选择"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<""<<endl;
}
return 0;
}int input() 
{struct hy *p,*head,*q;
q=new hy;/用NEW开辟一个存放HY类型数据的空间
p=q;head=q;int i;
ofstream outfile("f1.dat",ios::out);
 /定义文件流对象
cout<<"请依次输入:序号,用户名,性别,年龄,职业,资金,入会时间"<<endl;
cout<<" 中间用空格隔开,输入完毕后请再输入一个0,即可结束输入"<<endl;
for(i=0;;i++){
cin>>p->xh;
if(p->xh=="0") break;
else {cin>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
outfile<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)
<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl;
q=new hy;p->next=q;p=q;}}
outfile<<setw(10)<<p->xh<<endl;
outfile.close(); /关闭磁盘文件f1.dat  输入输出流
cout<<"您录入的球员信息已保存"<<endl;
return 0;}
int setin(){ hy *head,*p,*q;
q=new hy;
head=q;
p=head;
int i;
ifstream infile("f1.dat",ios::in);
for(i=0;;i++){
infile>>p->xh;
if(p->xh=="0")break;
else infile>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
q=new hy;
p->next=q;p=q;
}infile.close();
cout<<"请依次输入:序号,用户名,性别,年龄,职业,资金,入会时间"<<endl;
cout<<" 中间用空格隔开,输入完毕后请再输入一个0,即可结束输入"<<endl;
for(i=0;;i++){cin>>p->xh;
if(p->xh=="0") break;
else {cin>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
q=new hy;p->next=q;p=q;}}
cout<<"插入后的球员情况如下"<<endl;
ofstream outfile("f1.dat",ios::out);
p=head ;
for(i=0;;i++){
if(p->xh=="0") break;
else{cout<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p-<<nl<<p->
setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl; outfile<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)
<<p->zhya<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl;
p=p->next;}}
outfile<<setw(10)<<p->xh<<endl;
outfile.close();
cout<<"您录入的信息已插入"<<endl;
return 0;} 
int delate(){ hy *head,*p,*q,*r;
q=new hy; head=p;p=head;int i;
ifstream infile("f1.dat",ios::in);
for(i=0;;i++){
infile>>p->xh;if(p->xh=="0")break;
else infile>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
q=new hy;p->next=q;p=q;}infile.close();
p=head;int k=0;cout<<"请输入您要删除球员的序号"<<endl;string num;
cin>>num;if(head->xh==num){ k=1;head=head->next;}
else while(p->xh!="0"){r=p;p=p->next;
if(p->xh=num){k=1;r->next=p->next;break;}}
if(k=="0") cout<<没有找到您要删除的球员"<<endl;
ofstream outfile("f1.dat",ios:"out);
p=head;cout<<"删除后的信息如下"<<endl;
for(i=0;;i++){if(p->xh=="0") break;else {cout<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl; outfile<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl;p=p->next;}}
outfile<<setw(10)<<"0"<<endl;outfile.close();
cout<<"您已成功删除该球员的信息"<<endl; return 0;}
int correct(){ hy *head,*p,*q,q=new hy;string num1;
head=p;p=head;int i;
ifstream infile("f1.dat",ios::in);
for(i=0;;i++){
infile>>p->xh;
if(p->xh=="0")break;else infile>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
q=new hy;p->next=q;p=q;}
infile.close();p=head;int k=0;
cout<<"请输入您要修改球员的序号"<<num1;while(p->xh!="0"){
if(p->xh==num1)cout<<"请输入您要修改的球员资金"<<endl;
cin>>p->zj;break;}
else p=p->next;"cout<<"修改后的球员情况如下"<<endl;
ofstream outfile("f1.dat",ios:"out);
p=head;
for(i=0;;i++){if(p->xh=="0") break;else {cout<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl; outfile<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl;p=p->next;}}
outfile<<setw(10)<<"0"<<endl;outfile.close();
cout<<"您的修改已完成"<<endl;return 0;}
int search(){
hy *head,*p,*q,q=new hy;
head=p;p=head;int i,k=0,z;
ifstream infile("f1.dat",ios::in);
for(i=0;;i++){
infile>>p->xh;
if(p->xh=="0")break;else infile>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
q=new hy;p->next=q;p=q;}
p=head ;infile.close();
cout<<"按序号查询请输入1"  <<endl;
cout<<"按用户名查询请输入2"<< endl;
cin>>z;
if(z==1)cout<<"请输入您要查询的球员序号"<<endl;
string num1;cin>>num1;
while(p->xh!="0"){if(p->xh==num1){k=1;
cout<<"您要查询的球员情况如下"<<endl;
cout<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl;
break;} else p=p->next;}
if(k==0) cout<<"没有找到您要查找的球员"<<endl;
if(z==2) cout<<"请输入您要查询的用户名"<<endl; string name1; cin>>name1;
while(p->xh!="0"){if(p->yhm==name1){k=1;
cout<<"您要查询的球员情况如下"<<endl;
cout<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl; p=p->next;}
else p=p->next;}
if(k==0) cout<<"没有找到您要查找的球员"<<endl;}cout<<"您的查找已完成"<<endl;
return0 ;}
int tongji(){
hy *head,*p,*q,q=new hy;
head=p;p=head;int i;
ifstream infile("f1.dat",ios::in);
for(i=0;;i++){
infile>>p->xh;
if(p->xh=="0")break;else infile>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
q=new hy;p->next=q;p=q;}
p=head ;infile.close();
int z,k=0;
cout<<"按年龄段统计请输入1"<<endl;
cout<<"按入会时间统计请输入2"<<endl; cin>>z;if(z==1){
int age;cout<<"请输入您要查找的年龄"<<endl; cin>>age;
while(p->xh!="0")if(p->nl==age){k++;p=p->next;}else p=p->next;}cout<<"您要查询的球员人数为"<<k<<endl;}
if(z==2){char m[20];cout<<"请输入您要查找的入会时间"<<endl;cin>>m;while(p->xh!="0")
{if(p->xh==m){k++;p=p->next;}else p=p->next;}cout<<"您要查询的球员人数为"<<k<<kendl;}
cout<<"您的查找已完成<<endl;return 0;}
int display(){
hy *head,*p,*q,q=new hy;
head=p;p=head;int i;
ifstream infile("f1.dat",ios::in);
for(i=0;;i++){
infile>>p->xh;
if(p->xh=="0")break;else infile>>p->yhm>>p->xb>>p->nl>>p->zhy>>p->zj>>p->sj;
q=new hy;p->next=q;p=q;}
p=head ;infile.close();
while(p->xh!="0")
{cout<<setw(10)<<p->xh<<setw(10)<<p->yhm<<setw(10)<<p->xb<<setw(10)<<p->nl<<setw(10)<<p->zhy<<setw(10)<<p->zj<<setw(10)<<p->sj<<endl; p=p->next;}
cout<<"球员信息已显示"<<endl;return 0;}