版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、航空客運訂票系統(tǒng)程序要求:1、問題描述航空客運訂票的業(yè)務(wù)活動包括:查詢航線、客票預(yù)訂和辦理退票等。設(shè)計一個航空客運訂票系統(tǒng),以使上述業(yè)務(wù)可以借助計算機完成。2、要求1)每條航線所涉及的信息有:終點站名、航班號、飛機號、飛行周日(星期幾)、 乘員定額、余票量、已訂票的客戶名單(包括名字、訂票量、艙位等級 1、2、3) 以及等候替補的客戶名單;2)系統(tǒng)實現(xiàn)的功能如下:通過此系統(tǒng)可以實現(xiàn)如下功能:錄入:可以錄入航班情況(數(shù)據(jù)可以存儲在一個數(shù)據(jù)文件中,數(shù)據(jù)結(jié)構(gòu)、具體數(shù)據(jù)自定)查詢:可以查詢某個航線的情況(如,輸入航班號,查詢起降時間,起飛抵達(dá)城市,航班票價,票價折扣,確定航班是否滿倉);可以輸入起飛抵
2、達(dá)城市,查詢 飛機航班情況;訂票:(訂票情況可以存在一個數(shù)據(jù)文件中,結(jié)構(gòu)自己設(shè)定)可以訂票,如果該航班已經(jīng)無票,可以提供相關(guān)可選擇航班;退票:可退票,退票后修改相關(guān)數(shù)據(jù)文件;客戶資料有姓名,證件號,訂 票數(shù)量及航班情況,訂單要有編號。修改航班信息:當(dāng)航班信息改變可以修改航班數(shù)據(jù)文件存儲結(jié)構(gòu):航線的所有信息存儲在一個結(jié)構(gòu)體中,增加,查詢,訂票,退票等操 作按隊列的操作來實現(xiàn)。程序流程圖:Switch。)錄入功能請按次序輸入航班號,飛機號,終點站,飛行日期,乘客總數(shù),余票數(shù)等信息退出系統(tǒng)Switch(5)詳細(xì)代碼:#include <iostream.h>#include <st
3、dio.h>#include <string.h>#include <conio.h>#define m 4/3 架飛機#define n 5每架飛機5張票struct node char name21;char id21;int seat,plane,date;node *next,*pre; struct waitchar name21;char id21;char phone8;int seat,plane,date,count;wait *next,*pre;struct piaoint seatn+1;void makenull();void maken
4、ull_piao();void makenull_information();void list_menu();void list_piao();void makenull_wait();void list_information();void plane_information(node *head);void book();void add_information(node *head,int x,int y);void add_wait(int x,int y);void search_delete(int x);void write_to_file();void show_wait()
5、;bool comp(node *x,node*y);node *head1,*head2,*head3,*q;wait *wait_head,*wait_end;char c;piao am;void main()makenull();do list_menu();cout<<endl<<"choose an operation: " cin>>c;if (c!='6') switch(c)case '0' : show_wait();break;case '1' : list_piao(
6、);book();break;case '2' : search_delete(1);break;case '3' : list_piao();break;case '4' : list_information();break;case '5' : search_delete(0);break; default : break;while(c!='6');cout<<"Exit System "void makenull() makenull_piao();makenull_info
7、rmation();makenull_wait();void list_menu() cout<<endl<<""cout<<endl<<" cout<<endl<<" cout<<endl<<" cout<<endl<<" cout<<endl<<" cout<<endl<<" cout<<endl<<" cout
8、<<endl<<" cout<<endl<<" cout<<endl<<"cout<<endl<<""菜單 "*”* 0.查看排隊情況* 1.訂票* 2.退票* 3.查看剩余票* 4.查看飛機信息5 . 查看乘客信息6 . 退出;*”*”void makenull_piao()FILE *fp;int i;if(fp=fopen("piao.dat","r") = NULL )fp=fopen(&qu
9、ot;piao.dat","w");for (i=1;i<=m-1;i+)fwrite(&ai,sizeof(piao),1,fp);fclose(fp);fp=fopen("piao.dat","r");for(i=1;i<=m-1;i+)fread(&ai,sizeof(piao),1,fp);fclose(fp);void makenull_information()node *r;FILE *fp;int i,j,sum;sum=a1.seat0+a2.seat0+a3.seat0;fp=
10、fopen("information.dat","r");head1=new node;head2=new node;head3=new node;head1->pre=NULL;head1->next=NULL;head2->pre=NULL;head2->next=NULL;head3->pre=NULL;head3->next=NULL;q=head1;for(i=1;i<=sum;i+)j=0;r=new node;fread(r,sizeof(node),1,fp);q->next=r;r->
11、;pre=q;r->next=NULL;q=q->next;fclose(fp);if(i=a1.seat0+1) head2->next=q; q->pre->next=NULL; q->pre=head2;if(i=a1.seat0+a2.seat0+1) head3->next=q;q->pre->next=NULL; q->pre=head3;void makenull_wait()wait *tempw;FILE *fp;tempw=new wait;int i;if(fp=fopen("wait.txt"
12、;,"r") =NULL )fp=fopen("wait.txt","w");fclose(fp);wait_end=new wait;wait_head=new wait;wait_end->next=NULL;wait_end->pre=NULL;wait_head=wait_end;wait_head->count=0;fp=fopen("wait.txt","r");fread(wait_head,sizeof(wait),1,fp);for(i=1;i<=wai
13、t_head->count;i+) fread(tempw,sizeof(wait),1,fp); wait_end->next=tempw;tempw->pre=wait_end;tempw->next=NULL; wait_end=tempw;void list_piao()int i,j;for(i=1;i<=m-1;i+)if(ai.seat0!=n) cout<<endl<<"第"<<i<<"架飛機剩余的票:"<<endl; for(j=1;j<=n
14、;j+)if (ai.seatj=0) cout<<" "<<j;cout<<endl;else cout<<endl<<"The "<<i<<" plane is full !"<<endl<<endl;void list_information()int x;do cout<<endl<<"顯示哪架飛機的信息? " cin>>x;cout<<endl;whi
15、le(x<1 | x>=m);cout<<endl<<"第"<<x<<"架飛機的信息如下"<<endl;if(x=1) plane_information(head1);if(x=2) plane_information(head2);if(x=3) plane_information(head3);void plane_information(node *head) node *q;char ch;int x=0;if(head!=NULL && head->
16、next!=NULL) q=head->next;else q=NULL;cout<<"飛機空,無預(yù)訂票!"<<endl;while(q!=NULL)cout<<endl<<"*"<<endl;q->date=q->plane;cout<<"日期:"<<q->date<<endl;cout<<"座位號:"<<q->seat<<endl;cout<&l
17、t;"姓名:"<<q->name;cout<<endl<<"ID 號:"<<q->id;q=q->next;x+;if (x % 3 =0) ch=getch();cout<<endl;void book() int ij,p; cout«endl<<”請選擇地點:(1、2、3) do cin»i;if (i<1 | i>=m) cout«endl«"* 超出范圍! *"«endl
18、171;" 請重新輸入:) else cout«endl<<"你要訂的是到"«i«"地的飛機"«endl;cout«endl«"第"«i«"架飛機剩余的票:"«endl;for(p=1 ;p<=n;p+)if (ai.seatp=0) cout«" "«p; cout«endl; break; while(1); cout«endl<
19、<”請選擇座位號 : do cin»j; llj>n) cout«endl«"* 超出范圍! *"«endl«" 請重新輸入:) else ( q->date=i; cout«endl«"您的訂票日期 :"«q->date«endl; break;) while(1); if (ai.seatj=0) ai.seatj=1; cout«endl; ai.seat0+;if(i=1) add_information(head
20、 1,1 j);if(i=2) add_information(head2,2j); if(i=3) add_information(head3,3j);) else cout«endl«' 對不起,該座位已被預(yù)訂,您被安排到訂票等候隊列*"«endl;add_wait(ij);void add_wait(int x,int y) (wait *tempw;tempw=new wait;tempw->next=NULL;cout<<"請輸入個人信息"<<endl; cout<<endl
21、<<"*"<<endl; cout<<"姓名:"cin>>tempw->name; cout<<"ID 號:"cin>>tempw->id; cout<<"電話:"cin>>tempw->phone; tempw->seat=y;tempw->plane=x;wait_end->next=tempw; tempw->pre=wait_end;wait_end=wait_end-&
22、gt;next;cout<<endl<<"*正在排隊等候 *"<<endl;wait_head->count+;write_to_file();void show_wait()(wait *tempw;tempw=wait_head->next;if (tempw=NULL) cout<<endl<<" 排隊中沒有人! while(tempw!=NULL) (cout<<tempw->name<<" - "tempw=tempw->nex
23、t;"<<endl;void add_information(node *head,int x,int y) (node *temp;temp=new node;temp->pre=NULL;temp->next=NULL;cout<<"請輸入個人信息"<<endl;cout<<endl<<"*"<<endl; cout<<"姓名:"cin>>temp->name; cout<<"ID 號:
24、"cin>>temp->id; temp->seat=y;temp->plane=x;temp->next=head->next;temp->pre=head;if (head->next!=NULL) head->next->pre=temp;head->next=temp;write_to_file();cout<<endl<<"*訂票成功 *"<<endl;void search_delete(int x) node *p,*q,*r;wait *te
25、mpw,*tempw2,*tempw3;int step=1,t1,t2,i;char ch;p=new node;tempw=new wait;tempw2=new wait;tempw3=new wait;q=head1;cout<<endl<<"請輸入個人信息"<<endl;cout<<endl<<"姓名 :"cin>>p->name; doq=q->next;if ( (q!=NULL) &&(comp(q,p) ) cout<<end
26、l;q->date=q->plane;cout<<"Located!"<<endl;I*”.cout<<endl<<"姓名 :"<<q->name; cout<<endl<<"ID 號:"<<q->id; cout<<endl<<"座位號 :"<<q->seat; cout<<endl<<"班機號 :"<&
27、lt;q->plane;cout<<endl<<"日期:"<<q->date<<endl;if (x=1) cout<<"刪除該紀(jì)錄 ? Y/N"cin>>ch;if (ch='Y' | ch='y') t1=q->plane;t2=q->seat;at1.seatt2=0;at1.seat0-;r=q;q=q->pre; r->pre->next=r->next;if(r->next!=NULL)
28、 r->next->pre=r->pre;delete(r);cout<<"* 記錄刪除成功 !*"write_to_file();tempw=wait_head;for(i=0;i<wait_head->count;i+) tempw=tempw->next;if(tempw=NULL) break;if(tempw->plane=t1) && (tempw->seat=t2) strcpy(tempw3->name,tempw->name);strcpy(tempw3->pho
29、ne,tempw->phone);cout<<endl<<"等候的人中有可以訂票的了 :"<<endl;cout<<endl<<"姓名 :"<<tempw->name; cout<<endl<<"ID 號:"<<tempw->id<<endl; at1.seat0+;at1.seatt2=1;if(tempw->plane=1) add_information(head1,1,tempw-&g
30、t;seat); if(tempw->plane=2) add_information(head2,2,tempw->seat); if(tempw->plane=3) add_information(head3,3,tempw->seat);tempw2=tempw->pre;tempw2->next=tempw->next;if(tempw->next=NULL) wait_end=tempw2;else tempw->next->pre=tempw2; delete(tempw);wait_head->count-;wri
31、te_to_file();cout<<endl<<"等候的"<<tempw3->name<<"已經(jīng)成功訂票, 已經(jīng)由電話"<<tempw3->phone<<"通知了 "<<endl;break; continue; else if (q=NULL)step+;if(step=2) q=head2;if(step=3) q=head3;if(step=4) cout<<endl<<"*信息檢索完畢 *"break;while(1);bool comp(node *x,node *y)node *p,*q;int i,j,k;p=x;q
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度農(nóng)用耕地租賃與農(nóng)業(yè)人才培養(yǎng)合同范本
- 二零二五年度太陽能熱水器推廣應(yīng)用合同協(xié)議2篇
- 二零二五年度離婚協(xié)議中子女生活技能培訓(xùn)及就業(yè)指導(dǎo)合同4篇
- 2025版寧波房地產(chǎn)糾紛調(diào)解合同范本4篇
- 2025年度苗木種植基地土地流轉(zhuǎn)與農(nóng)業(yè)保險合同4篇
- 二零二五年度建筑周轉(zhuǎn)材料租賃管理及服務(wù)合同2篇
- 2025年度鋼材市場拓展與營銷服務(wù)合同
- 二零二五年度門衛(wèi)智能識別系統(tǒng)采購合同4篇
- 二零二五年度內(nèi)外墻抹灰工程安全質(zhì)量監(jiān)督合同
- 2025年度個人向小額貸款公司借款合同范本2篇
- 高考滿分作文常見結(jié)構(gòu)完全解讀
- 理光投影機pj k360功能介紹
- 六年級數(shù)學(xué)上冊100道口算題(全冊完整版)
- 八年級數(shù)學(xué)下冊《第十九章 一次函數(shù)》單元檢測卷帶答案-人教版
- 帕薩特B5維修手冊及帕薩特B5全車電路圖
- 系統(tǒng)解剖學(xué)考試重點筆記
- 小學(xué)五年級解方程應(yīng)用題6
- 云南省地圖含市縣地圖矢量分層地圖行政區(qū)劃市縣概況ppt模板
- 年月江西省南昌市某綜合樓工程造價指標(biāo)及
- 作物栽培學(xué)課件棉花
評論
0/150
提交評論