}
pr=pr->next;
p=pr->next;
}
printf("NO the customer!");
return ERROR;
}
int search_air(airline *head)
{
airline *p=head->next;
printf("air_num plane_num end_place total left\n");
for(;p!=NULL;p=p->next)
{
printf("%s %-10s %-8s %-8d%-8d\n",p->air_num,p->plane_num,p->end_place,p->total,p->left);
}
return OK;
}
int search_cus(customer *head)
{
struct customer *q=head->next;
printf("name air_num seat_num\n");
for(;q!=NULL;q=q->next)
{
printf("%-8s%-12s%-d\n",q->name,q->air_num,q->seat_num);
}
return OK;
}
int creat_air(airline **l)
{
airline *p=*l;
int i=0;
char *air_num[3]={"007af","008af","009af"};
char *plane_num[3]={"plane1","plane2","plane3"};
char *end_place[3]={"Beijing","Shanghai","Tianjin"};
int total[3]={100,100,100};
int left[3]={52,54,76};
for(i=0;i<3;i++)
insert_air(&p,air_num[i],plane_num[i],end_place[i],total[i],left[i]);
return OK;
}
int creat_cus(customer **l)
{
customer *p=*l;
int i=0;
char *name[3]={"zhsan","lisi","wangwu"};
char *air_num[3]={"007af","008af","009af"};
int seat_num[3]={2,5,7};
for(i=0;i<3;i++)
insert_cus(&p,name[i],air_num[i],seat_num[i]);
return OK;
}
void main()
{
int t=1;
customer *cus=start_cus();
airline *air=start_air();
char name[8],air_num[8],ch;
creat_air(&air);
creat_cus(&cus);
while(t==1)
{
printf("\n");
printf("*********************************\n");
printf("* Welcome to air firm! *\n");
printf("* book--------1 *\n");
printf("* cancel------2 *\n");
printf("* search------3 *\n");
printf("* exit--------4 *\n");
printf("*********************************\n");
ch=getch();
if(ch=='1')
{
printf("Please input a airline number:");
scanf("%s",air_num);
printf("Please input a name:");
scanf("%s",name);
book(air,air_num,cus,name);
}
else
if(ch=='2')
{
printf("Please input the cancel name:");
scanf("%s",name);
del_cus(cus,air,name);
}
else
if(ch=='3')
{
search_air(air);
printf("\n");