武汉长江工商学院计算机技术系
cout<<\
已
定
乘
客
cout<<\*********************\
DisplayClient(p->book);
cout<<\*********************\
} }
return NULL;
} p=p->next;
DisplayClient(p->wait); return p;
候补乘客
void Displaydes(AirPlane *flight,char d[]) //按目的地输出航班 {
AirPlane *p=new AirPlane; p=flight; int flag=0; while(p) {
if(strcmp(p->des,d)==0) {
flag=1;
cout<<\ Destination Flight Ticket Time \
cout<
26
武汉长江工商学院计算机技术系
}
}
<
PrintDate(p->time); cout<
if(flag==0)
cout<<\
void Creat(AirPlane *&flight) //录入航班 {
AirPlane *p; AirPlane *s=flight; Passenger *b,*w; char ch; do {
p=new AirPlane; b=new Passenger; w=new Passenger; b->next=NULL; w->next=NULL; p->book=b; p->wait=w;
27
武汉长江工商学院计算机技术系
}
system(\
cout<<\cin>>p->flight;
cout<<\cin>>p->ticket;
cout<<\cin>>p->des; InputDate(p->time);
cout<<\cin>>p->num;
cout<<\cin>>ch; system(\p->next=s->next; s->next=p;
}while(ch=='y'||ch=='Y');
void Display(AirPlane *flight) //输出航线 { int n;
cout<<\按终点查询 2.按航班查询\cout<<\cin>>n;
28
武汉长江工商学院计算机技术系
}
if(n==1) { }
else if(n==2) { } else
cout<<\cout<<\char f[20]; cin>>f;
Displayflight(flight,f); char d[20];
cout<<\cin>>d;
Displaydes(flight,d);
system(\
void Book(AirPlane *&flight) //订票 {
AirPlane *p=new AirPlane,*f=NULL; char line[20];
cout<<\cin>>line;
29
武汉长江工商学院计算机技术系
system(\
f=Displayflight(flight,line); //查找乘客要订的航班是否存在
if(f) { InputPassenger(f->book,f); Displayflight(flight,line);
} else
cout<<\}
void ReturnTicket(AirPlane *&flight) { AirPlane *p=new AirPlane,*f=NULL; char line[20]; char name[20];
cout<<\ cin>>line;
f=Displayflight(flight,line); if(f) { Passenger *p=f->book->next; Passenger *q=f->book;
int flag=0;
30
//退票