#include #include #include #define NOD struct plane_list struct plane {char number [10]; char start[10]; char arrive [10]; char date[10]; char starttime[10]; char arrivingtime[10]; char price[10]; char model[10]; }; NOD {char number [10]; char start[10]; char arrive [10]; char date[10]; char starttime[10]; char arrivingtime[10]; char price[10]; char model[10]; NOD*next; }; FILE *fp; /*由文件中的数据生成一个飞机航班的链表,如果文件不存在,则是一个空链表*/ NOD *load(char planename[]) { NOD *p,*q,*head; struct plane per; p=(NOD *)malloc(sizeof(NOD)); q=head=NULL; if((fp=fopen(planename,"rb"))==NULL) return head; else { while(!feof(fp)) { if(fread(&per,sizeof(struct plane),1,fp)==1) { p=(NOD *)malloc(sizeof(NOD)); strcpy(p->number,per.number); strcpy(p->start,per.start); strcpy(p->arrive,per.arrive); strcpy(p->date,per.date); strcpy(p->starttime,per.starttime); strcpy(p->arrivingtime,per.arrivingtime); strcpy(p->price,per.price); strcpy(p->model,per.model); head=p; p->next=q; q=head; } } } fclose(fp); return(head); } /*输入*/ NOD *insert(NOD *head) { NOD *temp,*p; p=head; temp=(NOD *)malloc(sizeof(NOD)); printf("\n\t 请输入航班号:"); scanf("%s",temp->number); printf("\n\t 请输入起点站:"); scanf("%s",temp->start); printf("\n\t 请输入终点站:"); scanf("%s",temp->arrive); printf("\n\t 请输入起飞时间:"); scanf("%s",temp->starttime); printf("\n\t 请输入到达时间:"); scanf("%s",temp->arrivingtime); printf("\n\t 请输入班期:"); scanf("%s",temp->date); printf("\n\t 请输入票价:"); scanf("%s",temp->price); printf("\n\t 请输入航班型号:"); scanf("%s",temp->model); head=temp; temp->next=p; return head; } /*保存*/ void save(NOD *head, char filename[]) {NOD*p; struct plane per; if((fp=fopen(filename,"wb"))==NULL) {printf(" 文件无法写入"); exit(0); } else { p=head; while(p!=NULL) { strcpy(per.number,p-...