欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    数据结构航空客运订票系统.pdf

    • 资源ID:73504367       资源大小:363.34KB        全文页数:13页
    • 资源格式: PDF        下载积分:11.9金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要11.9金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    数据结构航空客运订票系统.pdf

    -航空客运订票系统航空客运订票系统程序要求:程序要求:1 1、问题描述问题描述航空客运订票的业务活动包括:查询航线、客票预订和办理退票等。设计一个航空客运订票系统,以使上述业务可以借助计算机完成。2 2、要求要求1)每条航线所涉及的信息有:终点站名、航班号、飞机号、飞行周日(星期几)、乘员定额、余票量、已订票的客户(包括名字、订票量、舱位等级1、2、3)以及等候替补的客户;2)系统实现的功能如下:通过此系统可以实现如下功能:录入:可以录入航班情况(数据可以存储在一个数据文件中,数据结构、具体数据自定)查询:可以查询某个航线的情况(如,输入航班号,查询起降时间,起飞抵达城市,航班票价,票价折扣,确定航班是否满仓);可以输入起飞抵达城市,查询飞机航班情况;订票:(订票情况可以存在一个数据文件中,结构自己设定)可以订票,如果该航班已经无票,可以提供相关可选择航班;退票:可退票,退票后修改相关数据文件;客户资料有,证件号,订票数量及航班情况,订单要有编号。修改航班信息:当航班信息改变可以修改航班数据文件存储结构:航线的所有信息存储在一个结构体中,增加,查询,订票,退票等操作按队列的操作来实现。程序流程图:Switch(1)-.-总结资料-录入功能请按次序输入航班号,飞机号,终点站,飞行日期,乘客总数,余票数等信息-Switch(2)查询功能Switch(1)通过目的地查询请输入要查询的目的地Switch(3)订票功能请输入您需要的订票数Switch(2)通过航班号查询请输入要查询的航班号退票成功-.-总结资料-订票数余票数订票成功Switch(4)退票功能输入你的名字输入你定的票数订票数余票-Switch(5)退出系统详细代码:#include#include#include#include#define m 4/3 架飞机#define n 5/每架飞机 5 票struct nodechar name21;char id21;intseat,plane,date;node*next,*pre;struct waitchar name21;char id21;char phone8;intseat,plane,date,count;wait*next,*pre;struct piaoint seatn+1;void makenull();void makenull_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();bool comp(node*x,node*y);-.-总结资料-node*head1,*head2,*head3,*q;wait*wait_head,*wait_end;char c;piao am;void main()makenull();dolist_menu();coutendlc;if(c!=6)switch(c)case 0:show_wait();break;case 1:list_piao();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);coutExit System;void makenull()makenull_piao();makenull_information();makenull_wait();void list_menu()coutendl;coutendl菜单;coutendl*;coutendl*0.查看排队情况*;coutendl*1.订票*;coutendl*2.退票*;coutendl*3.查看剩余票*;coutendl*4.查看飞机信息*;coutendl*5.查看乘客信息*;coutendl*6.退出*;coutendl*;coutendl;-.-总结资料-void makenull_piao()FILE*fp;int i;if(fp=fopen(piao.dat,r)=NULL)fp=fopen(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;ipre=NULL;head1-next=NULL;head2-pre=NULL;head2-next=NULL;head3-pre=NULL;head3-next=NULL;q=head1;for(i=1;inext=r;r-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,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;icount;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)coutendl第 i 架飞机剩余的票:endl;for(j=1;j=n;j+)if(ai.seatj=0)cout j;coutendl;else coutendlThe i plane is full!endlendl;void list_information()int x;do coutendlx;coutendl;while(x=m);coutendl第 x 架飞机的信息如下next!=NULL)q=head-next;else q=NULL;cout飞机空,无预订票!endl;while(q!=NULL)coutendl*date=q-plane;cout日期:dateendl;cout座位号:seatendl;cout:name;coutendlID 号:id;q=q-next;x+;if(x%3=0)ch=getch();coutendl;-.-总结资料-void book()int i,j,p;coutendli;if(i=m)coutendl*超出围!*endl请重新输入:;elsecoutendl你要订的是到i地的飞机endl;coutendl第 i 架飞机剩余的票:endl;for(p=1;p=n;p+)if(ai.seatp=0)cout p;coutendl;break;while(1);coutendlj;if(jn)coutendl*超出围!*endldate=i;coutendl您的订票日期:dateendl;break;while(1);if(ai.seatj=0)ai.seatj=1;coutendl;ai.seat0+;if(i=1)add_information(head1,1,j);if(i=2)add_information(head2,2,j);if(i=3)add_information(head3,3,j);else coutendl*对不起,该座位已被预订,您被安排到订票等候队列*next=NULL;cout请输入个人信息endl;coutendl*endl;couttempw-name;couttempw-id;couttempw-phone;tempw-seat=y;tempw-plane=x;wait_end-next=tempw;tempw-pre=wait_end;wait_end=wait_end-next;coutendl*正在排队等候*count+;write_to_file();void show_wait()wait*tempw;tempw=wait_head-next;if(tempw=NULL)coutendl排队中没有人!endl;while(tempw!=NULL)coutnamenext;void add_information(node*head,int x,int y)node*temp;temp=new node;temp-pre=NULL;temp-next=NULL;cout请输入个人信息endl;coutendl*endl;couttemp-name;couttemp-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();coutendl*订票成功*endl;void search_delete(int x)node*p,*q,*r;wait*tempw,*tempw2,*tempw3;int step=1,t1,t2,i;char ch;p=new node;tempw=new wait;tempw2=new wait;tempw3=new wait;q=head1;coutendl请输入个人信息endl;cout*endl;coutendlp-name;doq=q-next;if(q!=NULL)&(comp(q,p)coutdate=q-plane;coutLocated!endl;cout*;coutendl:name;coutendlID 号:id;coutendl座位号:seat;coutendl班机号:plane;coutendl日期:dateendl;if(x=1)coutch;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)r-next-pre=r-pre;-.-总结资料-delete(r);cout*记录删除成功!*;write_to_file();tempw=wait_head;for(i=0;icount;i+)tempw=tempw-next;if(tempw=NULL)break;if(tempw-plane=t1)&(tempw-seat=t2)strcpy(tempw3-name,tempw-name);strcpy(tempw3-phone,tempw-phone);coutendl等候的人中有可以订票的了:endl;coutendl:name;coutendlID 号:idplane=1)add_information(head1,1,tempw-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;elsetempw-next-pre=tempw2;delete(tempw);wait_head-count-;write_to_file();coutendl等候的name已经成功订票,已经由phone通知了endl;break;continue;elseif(q=NULL)step+;-.-总结资料-if(step=2)q=head2;if(step=3)q=head3;if(step=4)coutendlnamei!=q-namej)&(p-namei!=0)i+;if(p-namei=0)return(false);break;elsek=i;while(p-namek=q-namej)&(q-namej!=0)k+;j+;if(q-namej=0)return(true);elsej=0;i+;while(q-namej!=0)&(p-namei!=0);return(false);void write_to_file()FILE*fp;int i,j;int xm;node*p;wait*tempw;tempw=new wait;tempw=wait_head;fp=fopen(piao.dat,w);-.-总结资料-for(i=1;i=m-1;i+)fwrite(&ai,sizeof(piao),1,fp);fclose(fp);fp=fopen(information.dat,w);x0=0;x1=a1.seat0;for(i=0,j=1;jnext;for(j=1;jnext;if(j=x2+1)p=head3-next;if(p=NULL)break;fwrite(p,sizeof(node),1,fp);p=p-next;fclose(fp);fp=fopen(wait.txt,w);for(j=0;jcount;j+)if(tempw=NULL)break;fwrite(tempw,sizeof(wait),1,fp);tempw=tempw-next;fclose(fp);-.-总结资料-

    注意事项

    本文(数据结构航空客运订票系统.pdf)为本站会员(w***)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开