C++학교 운동회 관리 시스템 실현

본 논문 의 사례 는 C++학교 운동회 관리 시스템 을 실현 하 는 구체 적 인 코드 를 공유 하여 여러분 께 참고 하 시기 바 랍 니 다.구체 적 인 내용 은 다음 과 같 습 니 다.

#include<iostream>
#include<fstream>
#include<string>
using namespace std;
void fun1()
{ 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<<endl;
 cout<<"*******************************"<<endl;
 cout<<endl;
 cout<<"*****       ,     !*****"<<endl;
}
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<<"           、  、    、    ."<<endl;
 cin>>a.number>>a.call>>a.place>>a.time;
 a.next=NULL;
  fout.write((char *)&a,sizeof(Match));
 cout<<"      ,      Y|y"<<endl;
 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<<"      !"<<endl; exit(0);
 }
  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<<"                 !"<<endl; 
 creat();
 Match *p1;
 p1=head1;
 cout<<"             :"<<endl;
 int number1;  //          
 int sign=0;  //       
 cin>>number1;
 while(p1!=NULL)
 { if(p1->number==number1) {sign=1;break;}
   p1= p1->next;
 }
 if (sign==0)
 cout<<"          !"<<endl;
 else
 {
 cout<<"               "<<endl;
 cout<<"------         ----1"<<endl;
 cout<<"------         ----2"<<endl;
 cout<<"------      ----3"<<endl;
 cout<<"------      ----4"<<endl;
 cout<<"          "<<endl;
 int a;
 int nu;   //      
 char info[20];   //      
 cin>>a;
 switch(a)
 {
 case 1:cout<<"         :"<<endl;
  cin>>nu;
  p1->number=nu; 
  cout<<"          !"<<endl; 
    break;
  case 2:cout<<"           :"<<endl;
 cin>>info;
   strcpy(p1->call,info);
 cout<<"          !"<<endl; 
   break;
  case 3:cout<<"         :"<<endl;
 cin>>info;
 strcpy(p1->time,info);
 cout<<"          !"<<endl; 
   break;
  case 4:cout<<"         :"<<endl;
 cin>>info;
 strcpy(p1->place,info);
 cout<<"          !"<<endl; 
  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<<"               "<<endl;
 cout<<"------         ----1"<<endl;
 cout<<"------         ----2"<<endl;
  cout<<"          "<<endl;
  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<<"          !"<<endl;
    else
    p2->next=p1->next;
 case 2: cin>>cal;
    while(p1!=NULL)
 { if(!strcmp(p1->call,cal)) {flag=1;break;}
    p2=p1;
    p1= p1->next;
 }
    if (flag==0)
    cout<<"          !"<<endl;
    else
    p2->next=p1->next;
 }
 ofstream fout("e:\\    .dat",ios::out);
 p1=head1;
 while(p1!=NULL)
 { 
  fout.write((char*)p1,sizeof(Match));
 p1=p1->next;
 } 
 
 fout.close();
 return 0;
}
void print1()
{
 creat();
 Match *p1=head1;
 cout<<"           、  、    、    ."<<endl;
 while(p1!=NULL)
 { cout<<p1->number<<'\t'<<p1->call<<'\t'<<p1->time<<'\t'<<p1->place<<endl;
  
 p1=p1->next;
 } 
}
void find1()
{ creat();
 Match *p1;
 p1=head1;
 int sign=0;//       
  cout<<"               "<<endl;
 cout<<"------          ----1"<<endl;
 cout<<"------          ----2"<<endl;
 cout<<"------       ----3"<<endl;
 cout<<"------       ----4"<<endl;
 cout<<"          "<<endl;
 int a;
 int nu;      //        
 char info[20];    //         
 cin>>a;
 switch(a)
 {
 case 1:cout<<"           :"<<endl;
  cin>>nu;
  while(p1!=NULL)
  { if(p1->number==nu) {sign=1;break;}
     p1= p1->next;
  }
    if (sign==0)
   cout<<"          !"<<endl; 
  else
    cout<<p1->number<<'\t'<<p1->call<<'\t'<<p1->time<<'\t'<<p1->place<<endl;
    break;
  case 2:cout<<"             :"<<endl;
 cin>>info;
   while(p1!=NULL)
  { if(p1->call==info) {sign=1;break;}
     p1= p1->next;
  }
    if (sign==0)
   cout<<"          !"<<endl; 
  else
    cout<<p1->number<<'\t'<<p1->call<<'\t'<<p1->time<<'\t'<<p1->place<<endl;    break;
  case 3:cout<<"           :"<<endl;
 cin>>info;
 while(p1!=NULL)
  { if(!strcmp(p1->time,info)) {sign=1;break;}
     p1= p1->next;
  }
    if (sign==0)
   cout<<"          !"<<endl; 
  else
    cout<<p1->number<<'\t'<<p1->call<<'\t'<<p1->time<<'\t'<<p1->place<<endl;   break;
  case 4:cout<<"           :"<<endl;
 cin>>info;
 while(p1!=NULL)
  { if(!strcmp(p1->place,info)) {sign=1;break;}
     p1= p1->next;
  }
    if (sign==0)
   cout<<"          !"<<endl; 
  else
    cout<<p1->number<<'\t'<<p1->call<<'\t'<<p1->time<<'\t'<<p1->place<<endl;  break;
 }
}
class Athlete
{
public:
 Athlete *next;
 int number;   //      
 char name[10];  //      
 char part[20];  //            
 char sex[20];   //     
 int age;    //     
 friend void input2();
};
void input2()
{ ofstream fout("e:\\   .dat",ios::app);
 char ch;
 Athlete b;
 do
 { cout<<"          、  、  、  、         ."<<endl;
 cin>>b.number>>b.name>>b.sex>>b.age>>b.part;
 b.next=NULL;
  fout.write((char *)&b,sizeof(Athlete));
  cout<<"      ,      Y|y"<<endl;
 cin>>ch;
 }while(ch=='y'||ch=='Y');
}
Athlete *head4;
void creat2()
{ head4=NULL;
 Athlete *p,*q=head4;
ifstream fin("e:\\   .dat",ios::in);
 if(!fin)
 {
 cout<<"      !"<<endl; exit(0);
 }
 p=new Athlete;
 fin.read((char*)p,sizeof(Athlete));
 while(!fin.eof()) 
 { if(head4==NULL) head4=p;
  else 
 q->next=p;
 q=p;
  p=new Athlete;
  fin.read((char*)p,sizeof(Athlete));
 }
 fin.close();
}
int change2()   //          
{
 cout<<"                !"<<endl; 
 creat2();
 Athlete *p1;
 p1=head4;
 cout<<"            :"<<endl;
 int number1;  //         
 int sign=0;  //       
 cin>>number1;
 while(p1!=NULL)
 { if(p1->number==number1) {sign=1;break;}
   p1= p1->next;
 }
  if (sign==0)
 cout<<"          !"<<endl;
 else
 {
 cout<<"              "<<endl;
 cout<<"------        ----1"<<endl;
 cout<<"------        ----2"<<endl;
 cout<<"------              ----3"<<endl;
 cout<<"------       ----4"<<endl;
  cout<<"------       ----4"<<endl;
 cout<<"          "<<endl;
 int a;
 int nu;    //      
 char info[20];   //      
  cin>>a;
 switch(a)
 {
 case 1:cout<<"          :"<<endl;
  cin>>nu;
  p1->number=nu; 
  cout<<"          !"<<endl; 
    break;
  case 2:cout<<"          :"<<endl;
 cin>>info;
   strcpy(p1->name,info);
  cout<<"         !"<<endl; 
   break;
case 3:cout<<"                 :"<<endl;
 cin>>info;
 strcpy(p1->part,info);
 cout<<"                !"<<endl; 
   break;
case 4:cout<<"       :"<<endl;
 cin>>info;
 strcpy(p1->sex,info);
 cout<<"         !"<<endl; 
  break;
case 5:cout<<"       :"<<endl;
 cin>>nu;
 p1->age=nu,
 cout<<"         !"<<endl; 
  break;
 }
 ofstream fout("e:\\   .dat",ios::out);
 p1=head4;
  while(p1!=NULL)
 { 
   fout.write((char*)p1,sizeof(Athlete));
 p1=p1->next;
 } 
fout.close();
 } 
 return 0;
}
int delete2()//            
{ creat2();
 Athlete *p1,*p2;
 p2=p1=head4;
 cout<<"              "<<endl;
 cout<<"------        ----1"<<endl;
 cout<<"------        ----2"<<endl;
  cout<<"          "<<endl;
  int n;
 cin>>n;
  int num,flag=0;
 char na[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<<"          !"<<endl;
    else
    p2->next=p1->next;
 case 2: cin>>na;
    while(p1!=NULL)
 { if(!strcmp(p1->name,na)) {flag=1;break;}
    p2=p1;
    p1= p1->next;
 }
    if (flag==0)
    cout<<"          !"<<endl;
    else
    p2->next=p1->next;
 }
 ofstream fout("e:\\   .dat",ios::out);
 p1=head4;
 while(p1!=NULL)
 { 
  fout.write((char*)p1,sizeof(Athlete));
 p1=p1->next;
 } 
fout.close();
 return 0;
}
void find2()
{ creat2();
 Athlete *p1;
 p1=head4;
 int sign=0;//       
  cout<<"              "<<endl;
 cout<<"------         ----1"<<endl;
 cout<<"------         ----2"<<endl;
 cout<<"          "<<endl;
 int a;
 int nu;      //        
 char info[20];    //         
 cin>>a;
 switch(a)
 {
 case 1:cout<<"            :"<<endl;
  cin>>nu;
  while(p1!=NULL)
  { if(p1->number==nu) {sign=1;break;}
     p1= p1->next;
  }
    if (sign==0)
   cout<<"          !"<<endl; 
  else
 cout<<p1->number<<'\t'<<p1->name<<'\t'<<p1->part<<'\t'<<p1->sex<<'\t'<<p1->age<<endl;
    break;
 case 2:cout<<"            :"<<endl;
 cin>>info;
   while(p1!=NULL)
  { if(p1->name==info) {sign=1;break;}
     p1= p1->next;
  }
    if (sign==0)
   cout<<"          !"<<endl; 
  else
   cout<<p1->number<<'\t'<<p1->name<<'\t'<<p1->part<<'\t'<<p1->sex<<'\t'<<p1->age<<endl; 
   break;
 }
}
void print2()
{
  creat2();
 Athlete *p1=head4;
 cout<<"          、  、         、  、  ."<<endl;
 while(p1!=NULL)
 { cout<<p1->number<<'\t'<<p1->name<<'\t'<<p1->part<<'\t'<<p1->sex<<'\t'<<p1->age<<endl;
 p1=p1->next;
 } 
}
class Message
{
public:
 Message *next;
 char name[10];  //     
 char avent[10];  //             
 int score ;   //  
 int ca;    //  
 friend void input3();
};
void input3()
{ ofstream fout("e:\\    .dat",ios::app);
 char ch;
 Message c;
 do
 { cout<<"            、    、    、    ."<<endl;
 cin>>c.name>>c.avent>>c.score>>c.ca;
 c.next=NULL;
  fout.write((char *)&c,sizeof(Message));
 cout<<"      ,      Y|y"<<endl;
 cin>>ch;
 }while(ch=='y'||ch=='Y');
fout.close();
}
Message *head7;
void creat3()
{ head7=NULL;
 Message *p,*q=head7;
ifstream fin("e:\\    .dat",ios::in);
 if(!fin)
 {
 cout<<"      !"<<endl; exit(0);
 }
 p=new Message;
 fin.read((char*)p,sizeof(Message));
 while(!fin.eof()) 
 { if(head7==NULL) head7=p;
  else 
 q->next=p;
 q=p;
  p=new Message;
  fin.read((char*)p,sizeof(Message));
 }
 fin.close();
}
int change3() //        
{ cout<<"                 !"<<endl; 
 creat3();
 Message *p1;
 p1=head7;
 cout<<"                 ! "<<endl;
 char na[20];
 char info[20];
 int sign=0;//       
 cin>>na>>info;
 while(p1!=NULL)
 { if((p1->name==na)&&(p1->avent==info)) {sign=1;break;}
   p1= p1->next;
 }
  if (sign==0)
 cout<<"          !"<<endl;
  else
 {
 cout<<"               "<<endl;
 cout<<"------          ----1"<<endl;
 cout<<"------         ----2"<<endl;
 cout<<"------      ----3"<<endl;
 cout<<"------      ----4"<<endl;
 cout<<"          "<<endl;
 int a;
 int nu;    //      
 char info[20];   //      
  cin>>a;
 switch(a)
 {
 case 1:cout<<"            :"<<endl;
  cin>>info;
  strcpy(p1->name,info); 
  cout<<"           !"<<endl; 
    break;
case 2:cout<<"           :"<<endl;
 cin>>info;
   strcpy(p1->avent,info);
  cout<<"          !"<<endl; 
   break;
case 3:cout<<"         :"<<endl;
 cin>>nu;
 p1->score=nu;
 cout<<"          !"<<endl; 
   break;
case 4:cout<<"         :"<<endl;
 cin>>nu;
 p1->ca=nu;
 cout<<"        !"<<endl; 
  break;
 }
 ofstream fout("e:\\    .dat",ios::out);
 p1=head7;
  while(p1!=NULL)
 { 
   fout.write((char*)p1,sizeof(Message));
 p1=p1->next;
 } 
 fout.close();
 } 
 return 0;
}
int delete3()      //             
{ creat3();
 Message *p1,*p2;
 p2=p1=head7;
 cout<<"                     :"<<endl;
 int flag=0;
 char na[20];
 char info[20];
 cin>>na>>info;
    while(p1!=NULL)
 { if((p1->name==na)&&(p1->avent==info)) {flag=1;break;}
    p2=p1;
    p1= p1->next;
 }
    if (flag==0)
    cout<<"          !"<<endl;
    else
    p2->next=p1->next;
 ofstream fout("e:\\    .dat",ios::out);
 p1=head7;
 while(p1!=NULL)
 { 
  fout.write((char*)p1,sizeof(Message));
 p1=p1->next;
 } 
fout.close();
 return 0;
}
void print3()
{
 creat3();
 Message *p1=head7;
 cout<<"              、      、    、    ."<<endl;
 while(p1!=NULL)
 { cout<<p1->name<<'\t'<<p1->avent<<'\t'<<p1->score<<'\t'<<p1->ca<<endl;
  p1=p1->next;
 } 
}
void find3()
{ creat3();
 Message *p1;
p1=head7;
int sign=0;   //       
 cout<<"                     ! "<<endl;   
 char na[20];
 char info[20];  //         
 cin>>na>>info;
 while(p1!=NULL)
  { if((p1->name==na)&&(p1->avent==info)) {sign=1;break;}
     p1= p1->next;
  }
    if (sign==0)
   cout<<"          !"<<endl; 
  else
    cout<<p1->name<<'\t'<<p1->avent<<'\t'<<p1->score<<'\t'<<p1->ca<<endl;
 }
int find()//    
{
 cout<<endl;
 cout<<"\t\t\t         :"<<endl;
 cout<<"\t\t            :1"<<endl;
 cout<<"\t\t           :2"<<endl;
 cout<<"\t\t            :3"<<endl;
 int j;
 cin>>j;
 switch(j)
 {
 case 1:find1();break;
 case 2:find2();break;
 case 3:find3();break;
 default:cout<<"      !"<<endl;
 }
 return 0;
}
int input()
{
 cout<<endl;
 cout<<"\t\t\t         :"<<endl;
 cout<<"\t\t            :1"<<endl;
 cout<<"\t\t           :2"<<endl;
 cout<<"\t\t            :3"<<endl;
 int j;
 cin>>j;
 switch(j)
 {
 case 1:input1();break;
 case 2:input2();break;
 case 3:input3();break;
 default:cout<<"      !"<<endl;
 }
 return 0;
}
int print()
{
 cout<<endl;
 cout<<"\t\t\t           :"<<endl;
 cout<<"\t\t              :1"<<endl;
 cout<<"\t\t             :2"<<endl;
 cout<<"\t\t              :3"<<endl;
 int j;
 cin>>j;
 switch(j)
 {
 case 1:print1();break;
 case 2:print2();break;
 case 3:print3();break;
 default:cout<<"      !"<<endl;
 }
 return 0;
}
int change()
{
 cout<<endl;
 cout<<"\t\t\t         :"<<endl;
 cout<<"\t\t            :1"<<endl;
 cout<<"\t\t           :2"<<endl;
 cout<<"\t\t            :3"<<endl;
 int j;
 cin>>j;
 switch(j)
 {
 case 1:change1();break;
 case 2:change2();break;
 case 3:change3();break;
 default:cout<<"      !"<<endl;
 }
 return 0;
}
int deleted()
{
 cout<<endl;
 cout<<"\t\t\t         :"<<endl;
 cout<<"\t\t            :1"<<endl;
 cout<<"\t\t           :2"<<endl;
 cout<<"\t\t            :3"<<endl;
 int j;
 cin>>j;
 switch(j)
 {
 case 1:delete1();break;
 case 2:delete2();break;
 case 3:delete3();break;
 default:cout<<"      !"<<endl;
 }
 return 0;
}
int main()
{ 
 int i;
 do
 {
 fun1();
cin>>i; 
 switch(i)
 {
 case 1:input();break;
 case 2:change();break;
 case 3:deleted();break;
 case 4:find();break;
 case 5: print();break;
 case 6: return 0;
 default:cout<<"       !"<<endl;
 }
 }while(1);
return 0;
}






몇 편의 글 을 추천 합 니 다.
C++간단 한 도서 관리 시스템 실현
C++간단 한 직원 정보 관리 시스템 실현
C++기초 학생 관리 시스템
관리 시스템 에 대한 더 많은 내용 은《관리 시스템 주 제》.을 클릭 하여 학습 하 세 요.
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.

좋은 웹페이지 즐겨찾기