资源描述:
《航空客运订票系统》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、航空客运订票系统#include#include#include#includetypedefstruct{intmon;intday;inthour;intmint;}Time;typedefstructPassagerinfo{charname[12];charID[20];intseatNo;}Passagerinfo;typedefstructFlightinfo{charcity1[12];charflightnum[10];charpl
2、anenum[10];Timesetout;Timearrive;floatprice;floatdisc;inttotalseat;intleftseat;intleftseat0;//真实的剩余位置(退票之后的)Passagerinfo*Pslist;Flightinfo*next;}Flightinfo;typedefstructPassagerinform{charname[12];charID[20];intseatNo;Flightinfo*flight;}Passagerinform;typedefstruct
3、Destination{charcity[12];Flightinfo*List;Destination*next;}Destination;Flightinfo*insertflight(Flightinfo*head,charcity[12]){Flightinfo*p0,*p1,*p2;p1=head;p0=(Flightinfo*)malloc(sizeof(Flightinfo));printf("航班号:");scanf("%s",&p0->flightnum);if(head==NULL){head=p0;p0
4、->next=NULL;}else{while(strcmp(p0->flightnum,p1->flightnum)!=0&&p1->next!=NULL){p2=p1;p1=p1->next;}if(strcmp(p0->flightnum,p1->flightnum)==0){printf("该航班已存在。");return(head);}else{p1->next=p0;p0->next=NULL;}}strcpy(p0->city1,city);//弥补城市printf("飞机号:");scanf("%s",&
5、p0->planenum);printf("出发时间(月/日/时/分):");scanf("%d/%d/%d/%d",&p0->setout.mon,&p0->setout.day,&p0->setout.hour,&p0->setout.mint);printf("抵达时间(月/日/时/分):");scanf("%d/%d/%d/%d",&p0->arrive.mon,&p0->arrive.day,&p0->arrive.hour,&p0->arrive.mint);printf("票价/元:");scanf("%f",
6、&p0->price);printf("折扣:");scanf("%f",&p0->disc);printf("总位置:");scanf("%d",&p0->totalseat);p0->leftseat=p0->totalseat;p0->leftseat0=p0->totalseat;p0->Pslist=(Passagerinfo*)malloc((p0->totalseat)*sizeof(Passagerinfo));return(head);}intQuitnum=0;Destination*insertdest
7、(Destination*head){Destination*p0,*p1,*p2;p0=(Destination*)malloc(sizeof(Destination));printf("抵达城市:");scanf("%s",&p0->city);p1=head;if(head==NULL){head=p0;p0->List=insertflight(NULL,p0->city);p0->next=NULL;return(head);}else{while(strcmp(p0->city,p1->city)!=0&&p1-
8、>next!=NULL){p2=p1;p1=p1->next;}if(strcmp(p0->city,p1->city)==0){p1->List=insertflight(p1->List,p0->city);}else{p1->next=p0;p0->List=insertflight