,.
}
}
n =fread(q,sizeof(passengernode),1,fp); if(n!=1)
break;
PList->rear->next=q; PList->rear=q;
PList->rear->next=NULL; fclose(fp);
void save_flight(flightnode *h) { }
void load_flight(flightnode *&h) {
flightnode *pt=h;
FILE* fp = fopen(\if(fp==NULL)
return; flightnode *q; int n;
while(!feof(fp)) {
q=(flightnode *)malloc(sizeof(flightnode)); n=fread(q,sizeof(flightnode),1,fp); FILE* fp = fopen(\if(fp==NULL)
return;
flightnode *temp=h->next; while(temp!=NULL) { };
fclose(fp);
fwrite(temp,sizeof(flightnode),1,fp); temp = temp->next;
,.
}
}
if(n!=1)
break; pt->next=q; pt=q;
pt->next=NULL; fclose(fp);
int find_same_flight(flightnode *h,char *flight_num) { m,
p->start_place,p->end_place,p->start_time,p->end_time,p->price,p->price_discount,p->isFull,p->left);
}
if(mark==0) {
printf(\Ǹûпѡĺ!\\n\return 0; }
p=p->next;
mark=1;
if((strcmp(t->start_place,p->start_place)==0)&&(strcmp(t->end_place,p->en
printf(\
{
d_place)== 0)&&(strcmp(t->flight_num,p->flight_num)!=0))
flightnode *t=h->next,*p=h->next; int mark=0;
printf(\\ɳwhile(t!=NULL && strcmp(t->flight_num,flight_num)!=0) t=t->next; while(p!=NULL){
\ִ\ʱ\ִʱ\۸\ۿ\Ƿ\\
,.
}
} return 1;
void insert_flight(flightnode *&h,char* flight_num,char* start_place,char* end_place,char* start_time,char* end_time,int left,float price,float price_discount,int isFull)
//¼뺽µĺ,µĺ뵽 { }
void insert_passengerList(flightnode *&h,passengerList *&PList,char *name,char *ID_num,char *flight_num,int ticket_num)
//ͻƱͻͻУӦĺϢ {
flightnode *p=h->next; for(;p!=NULL;p=p->next)
if(strcmp(p->flight_num,flight_num)==0) {
flightnode *q;//qΪӵĺָβ flightnode *p=h;
q=(flightnode *)malloc(sizeof(flightnode));//Ϊqռ strcpy(q->flight_num,flight_num); strcpy(q->start_place,start_place); strcpy(q->end_place,end_place); strcpy(q->start_time,start_time); strcpy(q->end_time,end_time); q->left=left; q->price=price;
q->price_discount=price_discount; q->isFull=isFull;
//strcpyӺĸϢƵq q->next=p->next;//qָΪ p->next=q;
p=p->next;//ָ
,.
}
}
p->left=p->left-ticket_num; if(p->left==0)
p->isFull=1;
passengernode *q=(passengernode *)malloc(sizeof(passengernode));//½strcpy(q->name,name); strcpy(q->ID_num,ID_num); strcpy(q->flight_num,flight_num); q->ticket_num=ticket_num; q->next=NULL; //¶ӵ PList->rear->next=q;
q->order_num=PList->rear->order_num+1;//ɶ PList->rear=q;
㣬µĿͻϢ
void delete_flight(flightnode *&h,passengerList *&PList) //ĿҪijɾ {
flightnode *p,*pr; passengernode *q,*qr; char flight_num[10]; int mark=1;
qr=PList->head;//prΪ˿ͷ
q=qr->next;//pΪмָԹ˿ҪɾĹ˿ͽв pr=h;//prΪͷ
p=pr->next;//pΪָԺҪɾĺв printf(\Ҫɾĺ:\scanf(\
while(p!=NULL)//Ҫɾĺ,ɾ {
if(strcmp(flight_num,p->flight_num)==0) {