欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 研究报告>
  • 工作总结>
  • 合同范本>
  • 心得体会>
  • 工作报告>
  • 党团相关>
  • 幼儿/小学教育>
  • 高等教育>
  • 经济/贸易/财会>
  • 建筑/环境>
  • 金融/证券>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > PDF文档下载  

    火车订票管理系统.pdf

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

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

    火车订票管理系统.pdf

    . . 学号 1115 选题三:火车票订票管理系统 1. 基本要求:为方便管理火车票购买信息,编写一个火车票订票管 理系统软件。系统记录必须包括订票人姓名、订票人身份证号、 始发站、终到站、票价、席别、订票时间等。 2. 基本管理功能: 1添加:增加一条订票人的记录到管理系统中。 2查询:根据订票人身份证查找订票人的相关信息并显示,若 找不到也要给出相应提示。 3修改:在管理系统中修改订票人的订票记录。 4保存:将所有订票信息保存在一个文件中(数据库文件或普 通的文本文件)。 5读取:从文件中读取已保存了数据。 6删除:从管理系统中删除一条记录。 7恢复:能恢复被删除的记录。 8统计:(A) 统计每天订票张数和总车票金额;(B) 统计单价 在 100 元以下、100400 元之间和 400 元以上的票数总张数 . . 及总金额; (C) 以表格形式打印所有订票信息。 源代码: #include #include #include #include using namespace std; int d;/用于选择 (按 1 继续,按2 退出,按他其他报错待完善) int x=1;/用于脱出while循环 string sfz;/身份证号码,用户输入可用到 class ticket public: string ID; string name; string Sstation; string Tstation; float price; string seat; string time; ticket *next; ticket(string I,string n,string S, string T,float p, string s,string t) ID=I;name=n;Sstation=S;Tstation=T;price=p;seat=s;time=t; void display(); ; void ticket:display() coutID=b)che=0;ch=NULL; else ch=ch-next; return che; . . int check1(string b)/ sbl ticket *ch; ch=del; int che=1; while(ch!=NULL) if(ch-ID=b)che=0;ch=NULL; else ch=ch-next; return che; int add() /将订票数据保存在一个基础链表中 system(“cls“); float price; string name,ID,Sstation,Tstation,seat,time; if(head=NULL) /以下为链表为空的情况 coutID; coutname; coutSstation; coutTstation; coutprice; coutseat; couttime; head=p1=p2=new ticket(ID,name,Sstation,Tstation,price,seat,time); x=1; while(x) system(“cls“); coutd; if(d=1) system(“cls“); p1-next=NULL; coutID; if(check(ID)=0)coutname; coutSstation; coutTstation; coutprice; coutseat; couttime; p1=new ticket(ID,name,Sstation,Tstation,price,seat,time); p2-next=p1; p2=p1; else if(d=2) p1-next=NULL; x=0; else coutnext!=NULL) p3=p3-next; x=1; while(x) system(“cls“); coutID; if(check(ID)=0)coutname; coutSstation; coutTstation; coutprice; coutseat; couttime; p0=new ticket(ID,name,Sstation,Tstation,price,seat,time); p3-next=p0; p3=p0; system(“cls“); coutd; if(d=1)x=1;p3-next=NULL; else if(d=2)p3-next=NULL;x=0; else coutID=a) x=0; else cha1=cha1-next; return cha1; ticket *search_1(string a)/改查 1 后面都得改,嗯,就这样了( ) . . ticket *cha1; cha1=del; x=1; while(x) if(cha1=NULL)x=0; else if(cha1-ID=a) x=0; else cha1=cha1-next; return cha1; ticket *search2(string b)/查询函数2,返回所要查询结点的前一个结点的指针,在删 除部分使用 ticket *cha2,*cha3; cha2=cha3=head; x=1; while(x) if(cha2-next=NULL)x=0; else if(cha2-ID=b)x=0; else cha3=cha2; cha2=cha2-next; return cha3; ticket *search_2(string b)/ -_- ticket *cha2,*cha3; cha2=cha3=del; x=1; while(x) if(cha2-next=NULL)x=0; else if(cha2-ID=b)x=0; else cha3=cha2; cha2=cha2-next; return cha3; void search() /用于用户查询功能( 目前只能查询一次,然后退出,待完善) system(“cls“); coutsfz; p3=search1(sfz); if(p3=NULL)coutdisplay();system(“pause“); void display1() / system(“cls“); ticket *dis; coutdisplay(); dis=dis-next; while(dis!=NULL); void modify()/修改函数,用于修改数据( 目前只可以修改单个订票信息,待完善) system(“cls“); display1(); coutsfz; p3=search1(sfz); if(p3=NULL) coutd; if(d=1)hui2: coutsfz; if(check(sfz)=0)coutID=sfz; else if(d=2)coutp3-name; else if(d=3)coutp3-Sstation; else if(d=4)coutp3-Tstation; else if(d=5)coutp3-price; else if(d=6)coutp3-seat; else if(d=7)coutp3-time; else coutd1; if(d1=1)x=1; else if(d1=2)x=0; else coutnext=NULL; else ticket *Dar; Dar=del; while(Dar-next!=NULL) Dar=Dar-next; Dar-next=c; Dar=c; Dar-next=NULL; void Delete()/删除函数将要删除的订票信息移出链表,并将所有删除信息结成另一链表, 供恢复使用 system(“cls“); display1(); coutsfz; p3=search1(sfz); p4=search2(sfz); if(p3=NULL)coutnext;Darea(p3);coutnext=NULL)p4-next=NULL;Darea(p3);coutnext=p3-next;Darea(p3);coutnext; else if(p3-next=NULL)p4-next=NULL; else p4-next=p3-next; void recover()/恢复函数,用于将已经删除的订票信息恢复 system(“cls“); ticket *r1,*r2,*r3; if(del=NULL)coutdisplay(); r1=r1-next; while(r1!=NULL); hui3: coutsfz; if(check1(sfz)=1)coutnext!=NULL)r2=r2-next; r3=search_1(sfz); r2-next=r3; r3-next=NULL; Rdel(sfz); coutdisplay(); dis=dis-next; while(dis!=NULL); system(“pause“); void count()/统计部分 system(“cls“); if(head=NULL)coutprice; n=n+1; m=m+i; if(i=100m3=m3+i; p3=p3-next; coutfilename1; filename1=filename1+“.txt“; 火车票 订票管理系统 savedata“+filename1;/此处路径根据需要自行更改 /*file.open(filename.c_str(),ios:in);/功能失败部分待完善 if(!file) d=1; else d=2; file.close(); if(d=1) file.open(filename.c_str(),ios:out); p1=head; x=1; while(x) if(p1!=NULL) fileIDnameSstationTstationpriceseatt imenext; else x=0; file.close(); couti; if(i=1) file.open(filename.c_str(),ios:out); . . p3=head; x=1; while(x) if(p3!=NULL) fileIDnameSstationTstationpriceseattimenext; else x=0; file.close(); coutIDnameSstationTstationpriceseattimenext; else x=0; file.close(); coutfilename1; filename1=filename1+“.txt“; 火车票 订票管理系统 savedata“+filename1;/此处路径根据需要自行更改 infile.open(filename.c_str(),ios:in); . . if(!infile) cerrnext=NULL; else L1=head; while(L1-next!=NULL) L1=L1-next; f=atof(aii+4.c_str(); L2=new ticket(aii,aii+1,aii+2,aii+3,f,aii+5,aii+6); L1-next=L2; L1=L2; L1-next=NULL; infile.close(); coutd; if(d=1) add();select(); if(d=2) search();select(); if(d=3) modify();select(); . . if(d=4) Delete();select(); if(d=5) recover();select(); if(d=6) display();select(); if(d=7) count();select(); if(d=8) save();select(); if(d=9) load();select(); else if(d=0) ticket *ex1,*ex2,*ex3,*ex4; ex1=head; while(ex1!=NULL) ex2=ex1; ex1=ex1-next; delete ex2; ex3=del; while(ex3!=NULL) ex4=ex3; ex3=ex3-next; delete ex4; cout_-

    注意事项

    本文(火车订票管理系统.pdf)为本站会员(白大夫)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!

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




    经营许可证编号:宁ICP备18001539号-1

    三一文库
    收起
    展开