版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、精選優(yōu)質文檔-傾情為你奉上 課程設計說明書學 院、系:專 業(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 模塊劃
2、分結構體(飛機和乘客) 菜單功能選擇函數(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
3、) 文件保存(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,
4、乘客的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 是
5、 否 退票成功 信息輸入有誤 圖 4-5 乘客退票 N-S 圖5 程序運行數(shù)據(jù)及其結果 圖 5-1 主菜單 圖 5-2 航班設定 圖 5-3 航班瀏覽 圖 5-4 機票訂購 圖 5-5 乘客退票 圖 5-6 售票信息瀏覽6 課程設計心得 通過這次C語言的課程設計,首先讓我回憶和重新鞏固C語言方面的知識,其次讓我明白了做任何事情不可能一次性成功,只有不斷地練習,不斷地改正、思考才能做出自己的東西。這次的實驗也是很好磨煉我們意志的機會,因為數(shù)個小時都待在機房,讓我們提前體驗自己專業(yè)的工作方式。 C語言是我們學習的一種基本語言,無論是在以后的學習還是工作中都有非常重要的作用和不可替代的作用。這次C語
6、言的課程設計并不是我學習C語言的結束,而是一個真正的開始。 通過這次的課程設計,不僅讓我重新認識或是了解到C語言它的強大功能以及多年來一直作為最受歡迎的一種語言的魅力??傊?,這幾天雖然累,但看著自己做出程序運行的成果,辛辛苦苦編出的代碼能順利的運行心里還是十分欣喜的。附錄#include <stdio.h>#include <string.h>#include <stdlib.h>#define N 100 int NowFlynum,NewFlynum;/當前航班數(shù)和新增航班數(shù) int r; /全局變量實現(xiàn)某個航班的所有票數(shù)增加 int e=0; /全局變
7、量用于瀏覽航班和售票信息 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;COS
8、TOMER 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(
9、);/根據(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("c
10、ls");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("
11、 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(a>9|a<1)b=1;printf("The number of your inpu
12、t 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()/*輸入航班設定*/syst
13、em("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;i<NewFlynum+NowFlynum;i+)printf("nplease input the %dst fl
14、ightn",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
15、.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 Begin
16、place 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_one_plane(i);printf("n");printf("t-n");printf("Press any key to continue.");getchar();getchar();men
17、u();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(&
18、quot; %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
19、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(a<1|a>3)b=1;printf("Your choice is wrong!please input again:&
20、quot;);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(" -&qu
21、ot;);printf("ntFlightID Beginplace EndPlace Begintime The Max costomer num The number of salen");for(int i=0;i<NewFlynum+NowFlynum;i+)/與所有的航班進行比較if(strcmp(s.Data,Pi.Data)=0)print_one_plane(i);printf("n");printf(" -n");printf("Press any key to continue.");ge
22、tchar();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
23、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("Press any key to continue.");getchar();getchar();Meun1();void Booking()/*訂票*/void compare();/重復的輸入void chooseNS();/無煙區(qū)v
24、oid chooseS();/吸煙區(qū)r=0;int i;/選擇變量int a=0;/循環(huán)變量int choose;char w;int d=-1;/選擇變量struct plane s;/聲明一個結構體變量system("cls");printf("tttWelcome To Thec Ticket Windown");printf("ttIt have 20 rows ,every row has 4 seats,'A','B','C','D'.ntt'A' an
25、d '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<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 informatio
26、n of salenplease input -y- to continue,or -n- exitnn");scanf("%s",&w);if(w='y')/選擇是否要進行已售票信息的瀏覽 beforeboookingBrowse();printf("Do you want a seat of Smoking or NoSmoking:nnplease 1 for Smoking,2 for NoSmoking: ");scanf("%d",&choose);if(choose=1)choo
27、seS();i=search();elsechooseNS();i=search();if(i!=-1)if(Pi.num>=Pi.Max)printf("This filght's 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 co
28、ntinue.");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
29、.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 numbe
30、r you want:nn");printf("row:");scanf("%d",&row);for(int a=0;) if(row>18|row<1) printf("Input error,row cann't more 18!please input again or please return and choose Smoking!n"); printf("row:"); scanf("%d",&row); else COSe.seatr
31、ow=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
32、compare(); void chooseS()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 y
33、ou 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!please input again or please return and choose Smoking!n"); printf("row:"); scanf("%d",&row); else
34、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
35、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;i<NewFlynum+NowFlynum;i+)r=r+Pi.num;for(int i=0;i&l
36、t;e;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
37、,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");sca
38、nf("%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)=0)k=i;strcpy(s.Data,Pi.Data);printf("nntttttInformation as follow:n");print_one_constomer(t);t
39、+;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 numb
40、er: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;i<NewFlynum+NowFlynum;i+)/查找航班號if(strcmp(s.ID,Pi.ID)=0)k=i;printf("ntFlightID Begin
41、place 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)
42、/信息的輸出函數(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;i<N;i+)if(strcmp(a.ID,COSi.id)=0)/判斷輸入的航班號dele(i);return i;void dele(int k)/*具體刪除信息*/int i;for(i=(k+1);i<N;i+)strcpy(COS,COSk+1.name);strcpy(COSk.ID
43、number,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("nt-The Information Of Sale-n");printf("nt Name Idcard seatrow seatcolume TheflightNOn");for(i=0;i<r;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
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度全國區(qū)域銷售合作協(xié)議書
- 2025年度舞蹈編導與教學團隊合作協(xié)議
- 二零二五年度電子商務平臺試用期勞動合同文本
- 水草船打撈施工方案
- 順義石油瀝青道路施工方案
- 景觀涼亭施工方案
- 二零二五年度煤炭開采企業(yè)安全生產(chǎn)責任保險合同3篇
- 數(shù)字化背景下的空間極化-深度研究
- 農(nóng)業(yè)供應鏈優(yōu)化模式-深度研究
- 醫(yī)療大數(shù)據(jù)集成平臺-深度研究
- 2024年秋季學期學校辦公室工作總結
- 鋪大棚膜合同模板
- 長亭送別完整版本
- 2024年英語高考全國各地完形填空試題及解析
- 智能養(yǎng)老院視頻監(jiān)控技術方案
- 你比我猜題庫課件
- 無人駕駛航空器安全操作理論復習測試附答案
- 建筑工地春節(jié)留守人員安全技術交底
- 默納克-NICE1000技術交流-V1.0
- 蝴蝶蘭的簡介
- 老年人心理健康量表(含評分)
評論
0/150
提交評論