資源描述:
《航空客運訂票系統(tǒng)》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、航空客運訂票系統(tǒng)#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("出發(fā)時間(月/日/時/分):");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