c版数据结构航空订票系统源代码

c版数据结构航空订票系统源代码

ID:31708293

大小:67.39 KB

页数:10页

时间:2019-01-17

c版数据结构航空订票系统源代码_第1页
c版数据结构航空订票系统源代码_第2页
c版数据结构航空订票系统源代码_第3页
c版数据结构航空订票系统源代码_第4页
c版数据结构航空订票系统源代码_第5页
资源描述:

《c版数据结构航空订票系统源代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、#ifndef_FLIGHT_H_#define_FLIGHT_H_#include<fstream>usingnamespacestd;structnode{intid;charstart[20];charover[20];floats_time;floato_time;intprice;floatsale;intticket;structnode*next;};structpeople{charname[20];charpasspart[20];intticket;intid;intnumber;structpeople*ne

2、xt;};classfly{public:voidadd();node*read();intselect();voidupdate();voidupdate_ticket(intid,intujd);ofstreamwe;ifstreamre;private:node*head;};classuserpublicflypublic:intadd();intinsert();voiddele();intuser_id;};#endif#include"iostream"#include"flight.h"

3、#include"fstream"usingnamespacestd;voidfly::add(){inti;node*p=newnode;node*s,*n;head二p;we.open("fligh匚txt",ios_base::app

4、ios_base::binary);cout<<"请依次输入航班信息:"<<endl;cout<<"航班号起飞地目的地起飞吋间降落时间票价折扣票数"<<endl;cin>&

5、gt;p->id>>p->start>>p->over>>p->s_time>>p->o_time>>p->price>>p■>sale>>p-&g(;ticket;while(p!二NULL){cout<<"是否再次输入?1是2否"<<endl;cin>>i;if(i=l){s=newnode;cin>>s-&g(;id>>s->s

6、tart>>s->over>>s->s_time>>s->o_time>>s->price>>s->sale>>s->ticket;p■>next=s;p二s;p->next=NULL;}elsep->next=NULL;p=p->next;n=head;while(n!=NULL){we

7、->next;}we.close();cout<<"录入成功"<<endl;}node*fly::read(){re.open("flight.txt"Jos_base::binary

8、ios_base::in);node*h,*s,*p;h=newnode;p=newnode;p■>next=NULL;re.read(reinterpret_cast<char*>(p),sizeof(structnode));h■>next=p;while(!re

9、.eof())s=newnode;re.read(reinterpret_cast<char*>(s),sizeof(structnode));p■>next=s;P=S;p->next=NULL;}re.close();returnh;intfly::select(){node*p,*h;h=read();p=h->next;inti;cout<<"您是要按1航班号2抵达城市3起飞城市cin>>i;if(i=l){查找?"<<endl;cout<&l

10、t;"请输入航班号"<<endl;cin>>i;for(;;)if(p■>id==i)cout<<&q

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。