数据结构课程设计:飞机订票系统设计与实现 (里面附有源代码!)

[2]李春葆 数据结构教程 (第二版) 北京:清华大学出版社,2007

附录:程序源代码

#include <> #include <> #include <> #include <>

typedef struct flightnode{ char flight_num[10]; n\ printf(\请输入:\ scanf(\ } }

int flight_num_check(flightnode *h,char *flight_num)n\\t\\t请选择输入:\ a=getch(); printf(\ if(a=='1') { printf(\请输入航班号:\ scanf(\ flight_num_check(p,flight_num); } else if(a=='2') { printf(\请输入起飞城市:\ scanf(\ printf(\请输入抵达城市:\ scanf(\ place_check(p,start_place,end_place); } else if(a=='3') check_all_flight(p); else return; }

int ID_name_check(passengerList *PList,char *name,char *ID_num) { passengernode *p=PList->head->next; int mark=0; printf(\订单号\姓名\证件号\航班号\订票数量\ for(;p!=NULL;p=p->next)

{ if(strcmp(p->ID_num,ID_num)==0&&strcmp(p->name,name)==0) { printf(\p->flight_num,p->ticket_num); mark=1; } } if(mark==0) { printf(\抱歉,没有%s,%s的订单信息!\\n\ return 0; } return 1; }

int order_num_check(passengerList *PList,int order_num) { passengernode *p=PList->head->next; printf(\订单号\姓名\证件号\航班号\订票数量\ for(;p!=NULL;p=p->next) { if(p->order_num==order_num) { printf(\p->flight_num,p->ticket_num); return 1; } } printf(\抱歉,没有订单号为%d的订单信息!\\n\ return 0; }

void check_all_passenger(passengerList *PList) { passengernode *p=PList->head->next; int m=0; printf(\订单号\姓名\证件号\航班号\订票数量\ for(;p!=NULL;p=p->next) { printf(\p->flight_num,p->ticket_num); m=1; } if(m==0) printf(\订单信息为空!\\n\ }

void passenger_check(passengerList *PList) { char name[20],ID_num[15]; int order_num; char a;

printf(\请选择订单查询方式:\\n\ printf(\表示按客户姓名和证件号进行查询;\\n\ printf(\表示按订单号进行查询;\\n\ printf(\表示查看全部订单信息.\\n\\t\\t请选择输入:\ a=getch(); printf(\ if(a=='1') { printf(\请输入客户姓名:\ scanf(\ printf(\请输入证件号:\ scanf(\ ID_name_check(PList,name,ID_num); } else if(a=='2') { printf(\请输入订单号:\ scanf(\ order_num_check(PList,order_num); } else if(a=='3') check_all_passenger(PList); else return; }

void modify_flight(flightnode *&h,passengerList *&PList) { flightnode *p=h->next; char flight_num[10],start_time[10],end_time[10]; char a; printf(\航线信息修改*************\\n\ printf(\ printf(\ 增加航班-------1 *\\n\ printf(\ 删除航班-------2 *\\n\ printf(\ 修改航班时间---3 *\\n\ printf(\ printf(\请选择:\ a=getch(); printf(\

if(a=='1') add_flight(h); else if(a=='2') delete_flight(h,PList); else if(a=='3') { printf(\请输入要修改的航班的航班号:\ scanf(\ if(flight_num_check(p,flight_num)==1) { printf(\请输入修改后的起飞时间:\ scanf(\ printf(\请输入修改后的抵达时间:\ scanf(\ for(;p!=NULL;p=p->next) if(strcmp(flight_num,p->flight_num)==0) { strcpy(p->start_time,start_time); strcpy(p->end_time,end_time); printf(\航班%s时间修改成功!\\n\ } } } else return; }

int book(flightnode *&h,passengerList *&PList) { char name[20]; n\ getch(); printf(\恭喜您,订票成功!\\n\ return 1; } else { printf(\很遗憾,该航班已满!***\\n\ printf(\如选择其他航班请输入-----1\\n\\t\\t***不选则输入-----0***\\n\ printf(\输入数字进行选择:\ scanf(\ if(k==1) { printf(\此航线上的其他航班有:\\n\ if(find_same_flight(h,flight_num)==1)

联系客服:779662525#qq.com(#替换为@)