![c語言飛機訂票系統(tǒng)設計_第1頁](http://file.renrendoc.com/FileRoot1/2019-11/13/66b9d387-9832-4e50-ab1e-12b68aafb428/66b9d387-9832-4e50-ab1e-12b68aafb4281.gif)
![c語言飛機訂票系統(tǒng)設計_第2頁](http://file.renrendoc.com/FileRoot1/2019-11/13/66b9d387-9832-4e50-ab1e-12b68aafb428/66b9d387-9832-4e50-ab1e-12b68aafb4282.gif)
![c語言飛機訂票系統(tǒng)設計_第3頁](http://file.renrendoc.com/FileRoot1/2019-11/13/66b9d387-9832-4e50-ab1e-12b68aafb428/66b9d387-9832-4e50-ab1e-12b68aafb4283.gif)
![c語言飛機訂票系統(tǒng)設計_第4頁](http://file.renrendoc.com/FileRoot1/2019-11/13/66b9d387-9832-4e50-ab1e-12b68aafb428/66b9d387-9832-4e50-ab1e-12b68aafb4284.gif)
![c語言飛機訂票系統(tǒng)設計_第5頁](http://file.renrendoc.com/FileRoot1/2019-11/13/66b9d387-9832-4e50-ab1e-12b68aafb428/66b9d387-9832-4e50-ab1e-12b68aafb4285.gif)
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
課程設計說明書學 院、系:專 業(yè):學 生 姓 名: 學 號:設 計 題 目:飛機訂票系統(tǒng)設計 起 迄 日 期:指 導 教 師:日期: 2017年5月12日1 設計目的(1) 實現(xiàn)航班的設定、航班信息的瀏覽和航班的查詢。(2) 實現(xiàn)乘客的飛機票的訂購、退票以及所定票的查詢。2 任務概述本飛機共有80個坐位,分20排,每排4個位子。編號為A,B,C,D。如10D表示 10排D座。A和D靠窗,19到20排為吸煙區(qū)。本系統(tǒng)可讓乘客自己選座號和區(qū)域直到乘客滿意為止,無法滿足的話,只能改乘另一個航班。定上票的乘客需給出姓名和身份證號,最后要打印出乘客清單。3 模塊劃分結(jié)構(gòu)體(飛機和乘客) 菜單功能選擇函數(shù) 航班設定函數(shù)飛機訂票系統(tǒng)設計按航班時間查找函數(shù) 航班瀏覽函數(shù)按降落地點查找函數(shù) 吸煙區(qū)函數(shù) 無煙區(qū)函數(shù) 乘客訂票函數(shù) 乘客退票函數(shù) 瀏覽乘客訂票信息 保存信息 載入信息 圖 3-1 功能模塊圖4 主要函數(shù)說明及其N-S圖(1) 主菜單函數(shù):功能的選擇(2) 航班設定函數(shù):設定航班數(shù)量、航班的起始點、航班時間(3) 航班瀏覽函數(shù):按時間查找瀏覽、按降落地點查找(4) 乘客訂票函數(shù):乘客姓名、身份證號以及所定航班的所有信息 1、無煙區(qū)函數(shù) 2、吸煙區(qū)函數(shù)(5) 乘客退票函數(shù):航班號、姓名和身份證號(6) 乘客信息瀏覽:乘客姓名、身份證號、座位號和航班號(7) 文件保存(8) 文件載入(9)退出飛機訂票系統(tǒng)N-S圖1、航班設定 輸入新增航班數(shù) i輸入航班號,起飛和降落地點以及時間和最大載客量Max售票數(shù)num 圖 4-1 航班設定 N-S圖2、輸入客戶信息輸入飛機的Pi.ID,Pi.BePlace,Pi.EndPlace,Pi.Data,Pi.Max 圖 4-2 輸入客戶信息 N-S圖3、 瀏覽航班信息1 選擇查詢方式 2 按時間查詢 按降落地點查詢是 和Pi.Data 否 是 和Pi.EndPlace 否輸出航班 輸出航班 輸出航班 輸出航班信息 信息不存在 信息 信息不存在 圖 4-3 瀏覽航班信息 N-S圖4、乘客訂票輸入航班號Pi.ID,乘客的COS,COSe.number,COSe.seat Strcmp(s.ID ,Pm.ID) m+ 是 char w=y 否beforeboookingBrowse(); 是 int choose= =1 否 chooses(); chooseNS();是 Pi.num=Pi.Max 否該航班票數(shù)已售完 訂票成功!打印出購票信息 圖 4-4 乘客訂票 N-S圖5、乘客退票 輸入航班號Pi.ID,乘客的COS,COSe.number S.ID=Pi.ID&COS=name&COSe.number=number 是 否 退票成功 信息輸入有誤 圖 4-5 乘客退票 N-S 圖5 程序運行數(shù)據(jù)及其結(jié)果 圖 5-1 主菜單 圖 5-2 航班設定 圖 5-3 航班瀏覽 圖 5-4 機票訂購 圖 5-5 乘客退票 圖 5-6 售票信息瀏覽6 課程設計心得 通過這次C語言的課程設計,首先讓我回憶和重新鞏固C語言方面的知識,其次讓我明白了做任何事情不可能一次性成功,只有不斷地練習,不斷地改正、思考才能做出自己的東西。這次的實驗也是很好磨煉我們意志的機會,因為數(shù)個小時都待在機房,讓我們提前體驗自己專業(yè)的工作方式。 C語言是我們學習的一種基本語言,無論是在以后的學習還是工作中都有非常重要的作用和不可替代的作用。這次C語言的課程設計并不是我學習C語言的結(jié)束,而是一個真正的開始。 通過這次的課程設計,不僅讓我重新認識或是了解到C語言它的強大功能以及多年來一直作為最受歡迎的一種語言的魅力??傊@幾天雖然累,但看著自己做出程序運行的成果,辛辛苦苦編出的代碼能順利的運行心里還是十分欣喜的。附錄#include #include #include #define N 100 int NowFlynum,NewFlynum;/當前航班數(shù)和新增航班數(shù) int r; /全局變量實現(xiàn)某個航班的所有票數(shù)增加 int e=0; /全局變量用于瀏覽航班和售票信息 typedef struct planechar ID10; /航班號char BePlace10; /起飛地點char EndPlace10; /降落地點char Data15; /起飛時間int Max; /最大乘客量int num; /已售票數(shù)PLANE;PLANE PN;typedef struct costomerchar name10; /乘客姓名char IDnumber20; /乘客身份證號char id20; /乘客所在的航班號int seatrow;/乘客所選的座位排號char seatcolumn5;/乘客所選的座位的列號COSTOMER;COSTOMER COSN;void menu(); /主菜單函數(shù)void input(int); /輸入航班具體信息 void Enter(); /輸入航班設定 void print_one_plane(int);/所有設定的航班信息 void print_one_plane_and_costomer(int);/乘客訂票后的相關信息 void print_one_costomer(int);/乘客的個人信息void dele(int);/具體刪除信息int Delect(struct plane);/尋找乘客所要退票的航班int Browse();/瀏覽航班信息void search_time();/根據(jù)時間查找航班void search_flight();/根據(jù)降落地點查找航班void Meun1();/查找航班菜單int search();/訂票中查找航班void Booking();/訂票void Refund();/退票void BrowseInformation();/瀏覽已售票信息void save();/保存文件void load();/載入文件void beforeboookingBrowse();/在訂票時瀏覽航班int main()menu();void menu()/*主菜單*/int a,b;/*中間變量,為了進行功能的選擇*/dosystem(cls);printf( *nnn);printf( The Airline ticket system of Taiyuannn);printf( 1.Input the new flightn);printf( 2.browse the flightn);printf( 3.Query the flightn);printf( 4.Bookingn);printf( 5.Refundn);printf( 6.Browse the information we have ticketsn);printf( 7.Saven);printf( 8.Loadn);printf( 9.Exitnnn);printf( *n);printf(Input your choice number(1-9):);scanf(%d,&a);if(a9|a1)b=1;printf(The number of your input is wrong.Please input again:);getchar();else b=0;while(b=1);switch(a)case 1:Enter();break;case 2:Browse();break;case 3:Meun1();break;case 4:Booking();break;case 5:Refund();break;case 6:BrowseInformation();break;case 7:save();break;case 8:load();break;case 9:exit(0);void Enter()/*輸入航班設定*/system(cls);void input(int);NewFlynum=0;NowFlynum=NowFlynum+NewFlynum;printf(Please input the number of flight:n);scanf(%d,&NewFlynum);printf(please input the information: );for(int i=0;iNewFlynum+NowFlynum;i+)printf(nplease input the %dst flightn,i+1);input(i);getchar();menu();void input(int i)/*輸入航班具體信息*/printf(Input the flight ID:n);scanf(%s,Pi.ID);printf(Input the place of beginplace:n);scanf(%s,Pi.BePlace);printf(Input the place of endplace:n);scanf(%s,Pi.EndPlace);printf(Input the time of begin:n);scanf(%s,Pi.Data);printf(Input the Max seats:n);scanf(%d,&Pi.Max);Pi.num=0;int Browse()/*瀏覽航班信息*/int i;r=0;system(cls);printf(nt-The Flight Browse-);printf(nt FlightID Beginplace EndPlace Begintime The Max costomer num The number of sale n);for(int i=0;iNewFlynum+NowFlynum;i+)r=r+Pi.num;for(int i=0;iNewFlynum+NowFlynum;i+)print_one_plane(i);printf(n);printf(t-n);printf(Press any key to continue.);getchar();getchar();menu();return i;void print_one_plane(int i)/*所有設定的航班信息*/printf( %s %s %s %s %d %d n,Pi.ID,Pi.BePlace,Pi.EndPlace,Pi.Data,Pi.Max,Pi.num);void print_one_constomer(int t)/*乘客訂票后的相關信息*/printf(nt FlightID Beginplace EndPlace Begintime The number of booking The sold tictetsn);printf( %s %s %s %s %d %d(row)%s(column)n,Pt.ID,Pt.BePlace,Pt.EndPlace,Pt.Data,1,COSe.seatrow,COSe.seatcolumn);void Meun1()/*查找航班菜單*/int a,b;dosystem(cls);printf(ttttttThe Operation Of Sale Ticketsnn);printf(tt*MENU1*nn);printf(tttt1.Look for the flight as time.n);printf(tttt2.Look for the flight as place.n);printf(tttt3.Return the menu;n);printf(nntt*n);printf(Input your choice number(1-3):);scanf(%d,&a);if(a3)b=1;printf(Your choice is wrong!please input again:);getchar();getchar();else b=0;while(b=1);switch(a)case 1:search_time();break;case 2:search_flight();break;case 3:menu();break;void search_time()/*根據(jù)時間查找航班*/int m=0;struct plane s;system(cls);printf(nplease input the time:);scanf(%s,s.Data);printf( -);printf(ntFlightID Beginplace EndPlace Begintime The Max costomer num The number of salen);for(int i=0;iNewFlynum+NowFlynum;i+)/與所有的航班進行比較if(strcmp(s.Data,Pi.Data)=0)print_one_plane(i);printf(n);printf( -n);printf(Press any key to continue.);getchar();getchar();Meun1();void search_flight()/*根據(jù)降落地點查找航班*/int m=0;struct plane s;system(cls);printf(nplease input flight:);scanf(%s,s.EndPlace);printf( -n);printf(ntFlightID Beginplace EndPlace Begintime The Max costomer num The number of sale n);for(int i=0;iNewFlynum+NowFlynum;i+)if(strcmp(s.EndPlace,Pi.EndPlace)=0)/與所有的降落地點進行比較print_one_plane(i);printf(n);printf( -n);printf(Press any key to continue.);getchar();getchar();Meun1();void Booking()/*訂票*/void compare();/重復的輸入void chooseNS();/無煙區(qū)void chooseS();/吸煙區(qū)r=0;int i;/選擇變量int a=0;/循環(huán)變量int choose;char w;int d=-1;/選擇變量struct plane s;/聲明一個結(jié)構(gòu)體變量system(cls);printf(tttWelcome To Thec Ticket Windown);printf(ttIt have 20 rows ,every row has 4 seats,A,B,C,D.nttA and D are close the window.19 and 20 are smokingplace.);printf(nplease input your flightID number:n);scanf(%s,s.ID);for(int m=0;m=Pi.Max)printf(This filghts tickets has been sold over!);elsePi.num+;strcpy(COSe.id,Pi.ID);e+;printf(nntttSuccess booking!n);elseprintf(This flight is no exist!);printf(Press any key to continue.);getchar();getchar();menu();else printf(The flight is no exist!please booking again!n);void compare()printf(Input error,column must be A,B,C or D.!please input again!n);printf(column:);scanf(%s,COSe.seatcolumn);void chooseNS()int row;printf(nnplease input your name:nn);scanf(%s,COS);printf(nn);printf(please input your Idcard number:nn);scanf(%s,COSe.IDnumber); printf(nn); printf(please input the ticket of number you want:nn);printf(row:);scanf(%d,&row);for(int a=0;) if(row18|row20|row18) printf(Input error,row cannt more 20 and less 18!please input again or please return and choose Smoking!n); printf(row:); scanf(%d,&row); else COSe.seatrow=row; break; printf(column:); scanf(%s,COSe.seatcolumn); for(int a=0;) if(strcmp(COSe.seatcolumn,A)=0|strcmp(COSe.seatcolumn,B)=0|strcmp(COSe.seatcolumn,C)=0|strcmp(COSe.seatcolumn,D)=0) COSe.seatcolumn; break; else compare(); void beforeboookingBrowse()int i;r=0;system(cls);printf(nt-The Flight Browse-);printf(nt FlightID Beginplace EndPlace Begintime The Max costomer num The number of sale The sold tictetsn);for(int i=0;iNewFlynum+NowFlynum;i+)r=r+Pi.num;for(int i=0;ie;i+)print_one_plane_and_costomer(i);printf(n);printf(t-n);printf(Press any key to continue );getchar();getchar(); void print_one_plane_and_costomer(int i)printf( %s %s %s %s %d %d %d(row)%s(column)n,Pi.ID,Pi.BePlace,Pi.EndPlace,Pi.Data,Pi.Max,Pi.num,COSi.seatrow,COSi.seatcolumn);int search()/*訂票中查找航班*/int k,t=0;struct plane s;k=-1;printf(Input the place of beginplace:n);scanf(%s,s.BePlace);printf(Input the place of endplace:n);scanf(%s,s.EndPlace);printf(Input the time of begin:n);scanf(%s,s.Data);for(int i=0;iNewFlynum+NowFlynum;i+)/*判斷輸入的信息與已存在的信息是否匹配*/if(strcmp(s.BePlace,Pi.BePlace)=0&strcmp(s.EndPlace,Pi.EndPlace)=0&strcmp(s.Data,Pi.Data)=0)k=i;strcpy(s.Data,Pi.Data);printf(nntttttInformation as follow:n);print_one_constomer(t);t+;break;if(k=-1)printf(nnNo exist!);return -1;else return k;void Refund()/*退票*/void print_one_plane1(int);int k=-1;int i;struct plane s;/system(cls);char name20;char number;printf(-Welcome To The Refund Ticket Window-n);printf(please input your flightID number:n);scanf(%s,s.ID);printf(please input your name:n);scanf(%s,name);printf(please input your Idcard number:n);scanf(%s,&number); for( i=0;iNewFlynum+NowFlynum;i+)/查找航班號if(strcmp(s.ID,Pi.ID)=0)k=i;printf(ntFlightID Beginplace EndPlace Begintime The number of you buyn);print_one_plane1(k);break;if(k=-1)printf(nnNo exist!);else Pi.num-;/總票數(shù)減一Delect(s);printf(nThe success is Refunding.n);printf(Press any key to continue.);getchar();getchar();menu();void print_one_plane1(int i)/信息的輸出函數(shù)printf( %s %s %s %s %d n,Pi.ID,Pi.BePlace,Pi.EndPlace,Pi.Data,1);int Delect(struct plane a)/*尋找乘客所要退票的航班*/int i;for(i=0;iN;i+)if(strcmp(a.ID,COSi.id)=0)/判斷輸入的航班號dele(i);return i;void dele(int k)/*具體刪除信息*/int i;for(i=(k+1);iN;i+)strcpy(COS,COSk+1.name);strcpy(COSk.IDnumber,COSk+1.IDnumber);strcpy(COSk.id,COSk+1.id);void BrowseInformation()/*瀏覽已售票信息*/int i;system(cls);r=0;for(i=0;iNewFlynum+NowFlynum;i+)r=r+Pi.num;printf(nt-The Information Of Sale-n);printf(nt Name Idcard seatrow seatcolume TheflightNOn);for(i=0;ir;i+)printf( %s %s %d(row)%s(column) %sn,COS,COSi.IDnumber,COSi.seatrow,COSi.seatcolumn,COSi.id);printf(nt-n);printf(Press any key to continue.);getchar();getchar();menu();void save()/*保存文件*/int w=1,m=1;r=
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年人社部的勞動合同(三篇)
- 2025年九年級英語下冊教學工作總結(jié)范例(二篇)
- 2025年中外來料加工、來件裝配合同樣本(2篇)
- 2025年代理權轉(zhuǎn)讓的合同(2篇)
- 2025年企業(yè)產(chǎn)品購銷合同參考模板(三篇)
- 2025年九年級英語培優(yōu)輔差總結(jié)樣本(二篇)
- 人工智能居間服務合同范本
- 親子餐廳裝修施工合同樣本
- 植生混凝土技術施工方案
- 木材加工居間合作協(xié)議
- 端午做香囊課件
- 外觀判定標準
- 江西上饒市2025屆數(shù)學高二上期末檢測試題含解析
- 腦卒中后吞咽障礙患者進食護理團體標準
- 墨香里的年味兒(2023年遼寧沈陽中考語文試卷記敘文閱讀題及答案)
- 2024-2030年市政工程行業(yè)發(fā)展分析及投資戰(zhàn)略研究報告
- 濟寧醫(yī)學院成人高等教育期末考試《無機化學》復習題
- 工行人工智能風控
- 新概念英語第二冊考評試卷含答案(第73-80課)
- 中醫(yī)腕踝針技術
- 2023風電機組預應力混凝土塔筒與基礎結(jié)構(gòu)設計標準
評論
0/150
提交評論