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++기초 학생 관리 시스템
관리 시스템 에 대한 더 많은 내용 은《관리 시스템 주 제》.을 클릭 하여 학습 하 세 요.
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Visual Studio에서 파일 폴더 구분 (포함 경로 설정)Visual Studio에서 c, cpp, h, hpp 파일을 폴더로 나누고 싶었습니까? 어쩌면 대부분의 사람들이 있다고 생각합니다. 처음에 파일이 만들어지는 장소는 프로젝트 파일 등과 같은 장소에 있기 때문에 파일...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.