




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、課程設(shè)計說明書學(xué) 院、系:專 業(yè):學(xué)生姓名:學(xué)號:設(shè)計 題目:飛機訂票系統(tǒng)設(shè)計起迄日期:指導(dǎo)教師:日期:2017年5月12日i1設(shè)計目的(1) 實現(xiàn)航班的設(shè)定、航班信息的瀏覽和航班的查詢。(2) 實現(xiàn)乘客的飛機票的訂購、退票以及所定票的查詢。2任務(wù)概述本飛機共有80個坐位,分20排,每排4個位子。編號為 A, B, C, D。如10D表示10排D座。A和D靠窗,19到20排為吸煙區(qū)。本系統(tǒng)可讓乘客自己選座號和區(qū)域直到乘客滿 意為止,無法滿足的話,只能改乘另一個航班。定上票的乘客需給出姓名和身份證號,最后要打印出 乘客清單。3模塊劃分圖3-1功能模塊圖4主要函數(shù)說明及其N-S圖 (1)主菜單函數(shù)
2、:功能的選擇(2)航班設(shè)定函數(shù):設(shè)定航班數(shù)量、航班的起始點、航班時間(3)航班瀏覽函數(shù):按時間查找瀏覽、按降落地點查找(4)乘客訂票函數(shù):乘客姓名、身份證號以及所定航班的所有信息1、無煙區(qū)函數(shù)2、吸煙區(qū)函數(shù)(5)乘客退票函數(shù):航班號、姓名和身份證號(6)乘客信息瀏覽:乘客姓名、身份證號、座位號和航班號(7)文件保存(8)文件載入(9)退出飛機訂票系統(tǒng)N-S圖1、航班設(shè)定輸入新增航班數(shù)i輸入航班號,起飛和降落地點以及時間和最大載客量Max售票數(shù)num圖4-1航班設(shè)定 N-S圖2、輸入客戶信息輸入飛機的 Pi.ID , Pi.BePlace , Pi.EndPlace , Pi.Data , Pi
3、.Max圖4-2輸入客戶信息N-S圖234、乘客訂票5程序運行數(shù)據(jù)及其結(jié)果圖5-1主菜單圖5-2航班設(shè)定CsUs e rsu-&erllC>es ktopXUntit I ecil.exep L曰-AIS H rInput Lih hiumJlvuwF f XXglliiit士p L C JI M Kin好11: t: he in rnx*ffn-n 1c inn ZInpu't L11H ±H無 f11五等htI n put;the;FllJit; ID:I in puL喏hepLcACH 。£ bt9 H £】jj JL«a&g
4、t;u =三kcw1 nipaj It七1IK妙工亂整日 oF RnrUjt 1 ncie"-:hVUI n puCit 1-iet; Ine of 力e1gr±n =1 2I rhpuL七h(yuǎn)eM-eLX音= £11.匕音-B0pLeginuInjpm 七 Uhut fljLgh 七I npuCt; heF1U ID =I n piu t七h(yuǎn)eplatTH o F ife-Q iiifiXeicre* "as1 n p4.it:tlwI1L6。個 o F c: n dx> In c- e- ss kAI npuct hie ime of 1)69
5、±jn -13|l nrtiut:ItzheHa. 乂 HE耳七M二圖5-3航班瀏覽(?!?!?!?Velcome To The Refund Ticket WindowCCP?nIeAse input yoiwflightID number:p21please input yournane :que please input yoiti*Idcard number:123Flight ID Beinplace EndPlace Beffint imeTKe nunber of youhuy w21(iuue121The sm:cess is Ref undine. Press an
6、y key to continue*圖5-5乘客退票C:LJ S#耳 £工工。6 匕 tdtOpLI Fit Isxc-Natine a占d.I doaLi*<d.1234j回11L116 I n£ o)1'iTi-a.t ioni Of £hI.日s e art 遒,0 w 岳 e At; co Iule©±2Cea- Itiirn >TH&fliffhtNO322圖5-6售票信息瀏覽6課程設(shè)計心得通過這次C語言的課程設(shè)計,首先讓我回憶和重新鞏固 C語言方面的知識,其次讓我明白了做 任何事情不可能一次性成功,只有不
7、斷地練習(xí),不斷地改正、思考才能做出自己的東西。這次的實 驗也是很好磨煉我們意志的機會,因為數(shù)個小時都待在機房,讓我們提前體驗自己專業(yè)的工作方式。C語言是我們學(xué)習(xí)的一種基本語言,無論是在以后的學(xué)習(xí)還是工作中都有非常重要的作用和不可替 代的作用。這次 C語言的課程設(shè)計并不是我學(xué)習(xí) C語言的結(jié)束,而是一個真正的開始。通過這次的課程設(shè)計,不僅讓我重新認(rèn)識或是了解到C語言它的強大功能以及多年來一直作為最受歡迎的一種語言的魅力??傊@幾天雖然累,但看著自己做出程序運行的成果,辛辛苦苦編出的代碼能順利的運行心里還是十分欣喜的。附錄#include <stdio.h>#include <s
8、tring.h>#include <stdlib.h>#define N 100int NowFlynum,NewFlynum;/ 當(dāng)前航班數(shù)和新增航班數(shù)int r;/全局變量實現(xiàn)某個航班的所有票數(shù)增加int e=0;/全局變量用于瀏覽航班和售票信息typedef struct plane char ID10;/ 航班號char BePlace10; / 起飛地點char EndPlace10; / 降落地點char Data15;/ 起飛時間int Max; /最大乘客量int num; /已售票數(shù)PLANE;PLANE PN;typedef struct costomer
9、char name10; / 乘客姓名char IDnumber20; / 乘客身份證號char id20; / 乘客所在的航班號int seatrow;/ 乘客所選的座位排號char seatcolumn5;/ 乘客所選的座位的列號COSTOMER;COSTOMER COSN;void menu(); / 主菜單函數(shù)void input(int); / 輸入航班具體信息void Enter(); / 輸入航班設(shè)定void print_one_plane(int);/所有設(shè)定的航班信息void print_one_plane_and_costomer(int);/乘客訂票后的相關(guān)信息void
10、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
11、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
12、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(&q
13、uot;Input your choice number(1-9):");scanf("%d",&a);if(a>9|a<1)b=1;printf("The number of your input is wrong.Please input again:"); getchar();elseb=0;while(b=1);switch(a)case 1:Enter();break;case 2:Browse();break;case 3:Meun1();break;case 4:Booking();break;case 5:R
14、efund();break;case 6:BrowseInformation();break;case 7:save();break;case 8:load();break;case 9:exit(0);void Enter()/* 輸入航班設(shè)定*/system("cls");void input(int);NewFlynum=0;NowFlynum=NowFlynum+NewFlynum;printf("Please input the number of flight:n");scanf("%d",&NewFlynum);
15、printf("please input the information:" );for(int i=0;i<NewFlynum+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 plac
16、e 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
17、=0;int Browse()/* 瀏覽航班信息*/int i;r=0;system("cls");printf("ntThe FlightBrowse");printf("nt FlightID Beginplace EndPlace Begintime The Max costomer num The number of sale n");for(int i=0;i<NewFlynum+NowFlynum;i+)r=r+Pi.num;for(int i=0;i<NewFlynum+NowFlynum;i+)print_
18、one_plane(i);printf("n");printf("tn");printf("Press any key to continue");getchar();getchar();menu();return i;void print_one_plane(int i)/* 所有設(shè)定的航班信息*/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
19、t)/* 乘客訂票后的相關(guān)信息*/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;do system("cls");p
20、rintf("ttttttThe Operation Of Sale Ticketsnn");printf("tt*MENU1*nn");printf("nntt*n");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("Input your ch
21、oice number(1-3):"); scanf("%d",&a);if(a<1|a>3)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
22、;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;i<NewFlynum+NowFlynum;i+)/ 與所有的航班進行比較if(strcmp(s.
23、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&quo
24、t;,s.EndPlace); printf("n");printf("ntFlightID Beginplace EndPlace Begintime The Max costomer num The number of sale n");for(int i=0;i<NewFlynum+NowFlynum;i+)if(strcmp(s.EndPlace,Pi.EndPlace)=0)/與所有的降落地點進行比較print_one_plane(i);printf("n");printf("n"); printf
25、("Press any key to continue");getchar();getchar(); Meun1(); void Booking()/* 訂票*/void compare();/重復(fù)的輸入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 Ti
26、cket Windown");printf("ttIt have 20 rows ,every row has 4 seats,'A','B','C','D'.ntt'A' and'D' are close the window.19 and 20 are smokingplace.");printf("nplease input your flightID number:n");scanf("%s",s.ID);for(int
27、m=0;m<NowFlynum+NewFlynum;m+)/* 循環(huán)找到要瀏覽的航班*/if(strcmp(s.ID,Pm.ID)=0)d=1;break;if(d=1)printf("nnDo you want to browse the information of salenplease input -y- to continue,or -n- exitnn");scanf("%s",&w);if(w='y')/ 選擇是否要進行已售票信息的瀏覽beforeboookingBrowse();printf("Do
28、 you want a seat of Smoking or NoSmoking:nnplease 1 for Smoking,2 for NoSmoking: ");scanf("%d",&choose);if(choose=1)chooseS();i=search();elsechooseNS();i=search();if(i!=-1)if(Pi.num>=Pi.Max) printf("This filght's tickets has been sold over!"); else Pi.num+; strcpy
29、(COSe.id,Pi.ID); e+;printf("nntttSuccess booking!n"); elseprintf("This flight is no exist!"); printf("Press any key to continue");getchar();getchar(); menu(); elseprintf("The flight is no exist!please booking again!n"); void compare()printf("Input error,c
30、olumn 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("p
31、lease 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(row>18|row<1)printf("Input error,row cann't mor
32、e 18!please input again or please return and choose Smoking!n");printf("row:");scanf("%d",&row);elseCOSe.seatrow=row;break;printf("column:");scanf("%s",COSe.seatcolumn);for(int a=0;)if(strcmp(COSe.seatcolumn,"A")=0|strcmp(COSe.seatcolumn,&qu
33、ot;B")=0|strcmp(COSe.seatcolumn,"C")=0|strcmp(COSe.seatcolumn,"D")=0)/判斷是否有輸入錯誤COSe.seatcolumn;break;elsecompare();void chooseS()int row;printf("nnplease input your name:nn");scanf("%s",COS);printf("nn");printf("please input your Idca
34、rd 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(row>20|row<18)printf("Input error,row cann't more 20 and less 18!ple
35、ase input again or please return and choose Smoking!n");printf("row:");scanf("%d",&row);elseCOSe.seatrow=row;break;printf("column:");scanf("%s",COSe.seatcolumn);for(int a=0;)if(strcmp(COSe.seatcolumn,"A")=0|strcmp(COSe.seatcolumn,"B&quo
36、t;)=0|strcmp(COSe.seatcolumn,"C")=0|strcmp(COSe.seatcolumn,"D")=0)COSe.seatcolumn;break;elsecompare();void beforeboookingBrowse()int i;r=0;system("cls");printf("ntThe FlightBrowse");printf("nt FlightID Beginplace EndPlace Begintime The Max costomernum The
37、 number of sale The sold tictetsn");for(int i=0;i<NewFlynum+NowFlynum;i+)r=r+Pi.num;for(int i=0;i<e;i+)print_one_plane_and_costomer(i);printf("n");printf("tn");printf("Press any key to continue ");getchar();getchar();void print_one_plane_and_costomer(int i)pr
38、intf(" %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,C OSi.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
39、 of endplace:n");scanf("%s",s.EndPlace);printf("Input the time of begin:n");scanf("%s",s.Data);for(int i=0;i<NewFlynum+NowFlynum;i+)/* 判斷輸入的信息與已存在的信息是否匹配*/if(strcmp(s.BePlace,Pi.BePlace)=0&&strcmp(s.EndPlace,Pi.EndPlace)=0&&strcmp(s.Data,Pi.Data)
40、=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;elsereturn k;void Refund()/* 退票 */void print_one_plane1(int); int k=-1;int i;struct plane s;/system("cls");char name20;char num
41、ber;printf("Welcome To The Refund Ticket Windown");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",&num
42、ber);for( i=0;i<NewFlynum+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!"); elsePi.num-;/總票數(shù)減一Delect(s);printf("nThe success is Refunding.
43、n"); printf("Press any key to continue");getchar();getchar();menu();void print_one_plane1(int i)/ 信息的輸出函數(shù) printf(" %s %s %s %s%dn",Pi.ID,Pi.BePlace,Pi.EndPlace,Pi.Data,1);int Delect(struct plane a)/* 尋找乘客所要退票的航班*/int i;for(i=0;i<N;i+)if(strcmp(a.ID,COSi.id)=0)/ 判斷輸入的航班號de
44、le(i); return i;void dele(int k)/* 具體刪除信息*/int i;for(i=(k+1);i<N;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;i<NewFlynum+NowFlynum;i+) r=r+Pi.num;printf("ntThe Information OfSalen");printf("nt Name Idcard seatrow seatcolume TheflightNOn");for(i=0;i<r;i+)printf(" %s %s %d(row)%s(column) %sn",COSi. name,COSi.IDnumber,COSi.seatrow,COSi.seatcolumn,COSi.id);prin
溫馨提示
- 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 教育數(shù)字化戰(zhàn)略規(guī)劃
- 汽車租賃與保養(yǎng)一體化服務(wù)合同
- 搜索引擎廣告優(yōu)化技巧與案例分析
- 影視特效技術(shù)的進步與發(fā)展趨勢
- 餐飲業(yè)餐廳裝修設(shè)計與施工合同
- 戶外運動設(shè)施的綠色節(jié)能溫控解決方案
- 精準(zhǔn)叉車裝卸作業(yè)合同模板
- 測繪儀器銷售保密協(xié)議范本
- 教與學(xué)的關(guān)系理論及實踐研究
- 教育信息化在終身教育中的運用
- SB/T 10784-2012洗染服務(wù)合約技術(shù)規(guī)范
- GB/T 16940-2012滾動軸承套筒型直線球軸承外形尺寸和公差
- GB/T 15814.1-1995煙花爆竹藥劑成分定性測定
- 煤礦安全規(guī)程露天部分參考題庫(含答案)
- 紫銅材質(zhì)證明
- 新產(chǎn)品評審管理辦法
- (參考)菲達公司國內(nèi)電除塵器業(yè)績表
- 游泳池水質(zhì)檢測記錄表
- 大學(xué)生職業(yè)生涯規(guī)劃與就業(yè)指導(dǎo)教案第5講:興趣探索
- 門店電表記錄表
- 七年級勞技 花卉種植 花卉用途 PPT學(xué)習(xí)教案
評論
0/150
提交評論