



版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、课程设计说明书学院、系:专业:学生姓名:学号:设 计 题 目:飞机订票系统设计起迄日期:指导教师:日期:2017年 5月 12日11 设计目的( 1) 实现航班的设定、航班信息的浏览和航班的查询。( 2) 实现乘客的飞机票的订购、退票以及所定票的查询。2 任务概述本飞机共有80 个坐位,分20 排,每排4 个位子。编号为A, B, C,D。如 10D表示 10 排 D 座。 A 和 D靠窗, 19 到 20 排为吸烟区。本系统可让乘客自己选座号和区域直到乘客满意为止,无法满足的话,只能改乘另一个航班。定上票的乘客需给出姓名和身份证号,最后要打印出乘客清单 。3 模块划分结构体(飞机和乘客)菜单
2、功能选择函数航班设定函数飞按航班时间查找函数机航班浏览函数订票按降落地点查找函数系统吸烟区函数设乘客订票函数计无烟区函数乘客退票函数浏览乘客订票信息保存信息载入信息图 3-1功能模块图4 主要函数说明及其N-S 图( 1 ) 主菜单函数:功能的选择( 2 ) 航班设定函数:设定航班数量、航班的起始点、航班时间( 3 ) 航班浏览函数:按时间查找浏览、按降落地点查找2( 4 ) 乘客订票函数:乘客姓名、身份证号以及所定航班的所有信息1 、无烟区函数2 、吸烟区函数( 5 ) 乘客退票函数:航班号、姓名和身份证号( 6 ) 乘客信息浏览:乘客姓名、身份证号、座位号和航班号( 7 ) 文件保存( 8
3、 ) 文件载入( 9 )退出飞机订票系统N-S 图1 、航班设定输入新增航班数i输入航班号,起飞和降落地点以及时间和最大载客量Max 售票数 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 图34 、乘客订票输入航班号Pi.ID ,乘客的COS
4、,COSe.number ,COSe.seatStrcmp(s.ID ,Pm.ID)m+是char w=y否beforeboookingBrowse();是int choose= =1否chooses();chooseNS();是Pi.num>=Pi.Max否该航班票数已售完订票成功!打印出购票信息图 4-4乘客订票N-S 图5 、乘客退票输入航班号Pi.ID ,乘客的COS,COSe.numberS.ID=Pi.ID&&COS=name&&COSe.number=number是否退票成功信息输入有误图 4-5乘客退票N-S图5 程
5、序运行数据及其结果4图 5-1 主菜单图 5-2 航班设定5图 5-3航班浏览图 5-4机票订购6图 5-5乘客退票图 5-6售票信息浏览6 课程设计心得通过这次C 语言的课程设计,首先让我回忆和重新巩固C 语言方面的知识,其次让我明白了做任何事情不可能一次性成功,只有不断地练习,不断地改正、思考才能做出自己的东西。这次的实验也是很好磨炼我们意志的机会,因为数个小时都待在机房,让我们提前体验自己专业的工作方式。C 语言是我们学习的一种基本语言,无论是在以后的学习还是工作中都有非常重要的作用和不可替代的作用。这次C 语言的课程设计并不是我学习C 语言的结束,而是一个真正的开始。通过这次的课程设计
6、,不仅让我重新认识或是了解到C 语言它的强大功能以及多年来一直作为最受欢迎的一种语言的魅力。总之,这几天虽然累,但看着自己做出程序运行的成果,辛辛苦苦编7出的代码能顺利的运行心里还是十分欣喜的。附录#include <stdio.h>#include <string.h>#include <stdlib.h>#define N 100int NowFlynum,NewFlynum;/当前航班数和新增航班数int r;/全局变量实现某个航班的所有票数增加int e=0;/全局变量用于浏览航班和售票信息typedef struct planechar ID10;
7、/航班号char BePlace10; /起飞地点char EndPlace10; /降落地点char Data15;/起飞时间int Max;/最大乘客量int num;/已售票数PLANE;PLANE PN;typedef struct costomerchar name10;/乘客姓名char IDnumber20; /乘客身份证号char id20; /乘客所在的航班号intseatrow;/乘客所选的座位排号char seatcolumn5;/乘客所选的座位的列号COSTOMER;COSTOMER COSN;void menu();/主菜单函数void input(int); /输入
8、航班具体信息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();/根据时间查找航班void search_flight();/根据降落地点查找航班void Meun1(
9、);/查找航班菜单int search();/订票中查找航班8void 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
10、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(&qu
11、ot;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 input is wrong.Please input again:"); getchar();elseb=0;while(b
12、=1);switch(a)case 1:Enter();break;case 2:Browse();break;case 3:Meun1();break;9case 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=NowF
13、lynum+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 flightn",i+1);input(i);getchar();menu();void input(int i)/*
14、输入航班具体信息*/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
15、("%s",Pi.Data);printf("Input the Max seats:n");scanf("%d",&Pi.Max);Pi.num=0;int Browse()/*浏览航班信息 */10int i;r=0;system("cls");printf("nt-The FlightBrowse-");printf("nt FlightID Beginplace EndPlace Begintime The Max costomer num The number of
16、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();menu();return i;void print_one_plane(int i)/*所有设定的航班信息*/printf(
17、"%s%s%s%s%d%dn",Pi.ID,Pi.BePlace,Pi.EndPlace,Pi.Data,Pi.Max,Pi.num);void print_one_constomer(int t)/*乘客订票后的相关信息*/printf("nt FlightIDBeginplaceEndPlaceBegintimeThe number ofbookingThe sold tictetsn");printf("%s%s%s%s%d%d(row)%s(column)n",Pt.ID,Pt.BePlace,Pt.EndPlace,Pt.D
18、ata,1,COSe.seatrow,COSe.seatcolumn);void Meun1()/*查找航班菜单 */int a,b;11dosystem("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");
19、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:");getchar();getchar();else b=0;while(b=1);switch(a)case 1:search_ti
20、me();break;case 2:search_flight();break;case 3:menu();break;void search_time()/*根据时间查找航班*/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 costom
21、er num The number of salen");for(int i=0;i<NewFlynum+NowFlynum;i+)/与所有的航班进行比较if(strcmp(s.Data,Pi.Data)=0)12print_one_plane(i);printf("n");printf("-n");printf("Press any key to continue.");getchar();getchar();Meun1();void search_flight()/*根据降落地点查找航班*/int m=0;stru
22、ct 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;i<NewFlynum+NowFlynum;i+)if(strcmp(s.EndPlace,Pi.
23、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();/无烟区void chooseS();/吸烟区13r=0;int i;/选择变量int a=0;/循环变量int choose;char w;int d=-
24、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' and 'D' are close the window.19 and 20 are smokingplace.");p
25、rintf("nplease input your flightID number:n");scanf("%s",s.ID);for(int m=0;m<NowFlynum+NewFlynum;m+)/*循环找到要浏览的航班*/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("
26、;%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)chooseS();i=search();elsechooseNS();i=search();if(i!=-1)if(Pi.num>=Pi.Max
27、)14printf("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 continue.");getchar();getchar();menu();elseprintf("The flight
28、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 na
29、me: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",&r
30、ow);for(int a=0;)15if(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);elseCOSe.seatrow=row;break;printf("column:");scanf("%s",COSe.seatcolumn
31、);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;elsecompare();void chooseS()int row;printf("nnplease input your name:nn");scanf(
32、"%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
33、(row>20|row<18)16printf("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);elseCOSe.seatrow=row;break;printf("column:");scanf("%s",COSe.seatcolumn);for(
34、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;elsecompare();void beforeboookingBrowse()int i;r=0;system("cls");printf("nt-The FlightBrows
35、e-");printf("nt FlightIDBeginplaceEndPlaceBegintimeThe Max costomernumThe number of saleThe 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");17printf("t-n");printf("Press any k
36、ey 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
37、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;i<NewFlynum+NowFlynum;i+)/*判断输入的信息与已存在的信息是否匹配*/if(strcmp(s.BePlace,Pi.BePla
38、ce)=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;18elsereturn k;void Refund()/*退票 */void print_one_plane1(i
39、nt);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);pri
40、ntf("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 Beginplace EndPlace Begintime The number of you buyn");print_one_plane1(k);break;if(k=-1)printf("nnNo exist!&q
41、uot;);elsePi.num-;/总票数减一Delect(s);printf("nThe success is Refunding.n");printf("Press any key to continue.");getchar();getchar();menu();19void print_one_plane1(int i)/信息的输出函数printf("%s%s%s%s%dn",Pi.ID,Pi.BePlace,Pi.EndPlace,Pi.Data,1);int Delect(struct plane a)/*寻找乘客所要退
42、票的航班*/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.IDnumber,COSk+1.IDnumber);strcpy(COSk.id,COSk+1.id);void BrowseInformation()/*浏览已售票信息 */int i;system("cls");r=0
43、;for(i=0;i<NewFlynum+NowFlynum;i+)r=r+Pi.num;printf("nt-The Information OfSale-n");printf("ntNameIdcardseatrow seatcolumeTheflightNOn");for(i=0;i<r;i+)20printf("%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.&
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 买卖合同工厂买卖协议书
- 药房用工劳动合同书
- 桉树林木买卖合同
- 承包树木种植合同
- 建筑施工企业农民工劳动合同书
- 小学信息技术三年级上册第4课《用计算机辅助学习》教学设计
- 海南经贸职业技术学院《生物质纳米材料》2023-2024学年第二学期期末试卷
- 4《夜书所见》教学设计-2024-2025学年三年级上册语文统编版
- 金华职业技术学院《环境生物监测与修复技术》2023-2024学年第二学期期末试卷
- 天津仁爱学院《计算机系统的局限性》2023-2024学年第二学期期末试卷
- HRBP工作总结与计划
- 2025年湖南高速铁路职业技术学院高职单招语文2018-2024历年参考题库频考点含答案解析
- 2025年上半年中电科太力通信科技限公司招聘易考易错模拟试题(共500题)试卷后附参考答案
- 2025年沙洲职业工学院高职单招语文2018-2024历年参考题库频考点含答案解析
- DB3502T052-2019 家政服务规范 家庭搬家
- 儿童故事绘本愚公移山课件模板
- 会计学专业数智化转型升级实践
- 中国糖尿病防治指南(2024版)解读-1
- 2024年计算机二级WPS考试题库(共380题含答案)
- 2024年德州职业技术学院单招职业适应性测试题库
- 跨学科实践活动10调查我国航天科技领域中新型材料新型能源的应用课件九年级化学人教版(2024)下册
评论
0/150
提交评论