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

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

ID:17047227

大小:15.95 KB

页数:10页

时间:2018-08-27

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

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

1、#ifndef_FLIGHT_H_#define_FLIGHT_H_#includeusingnamespacestd;structnode{intid;charstart[20];charover[20];floats_time;floato_time;intprice;floatsale;intticket;structnode*next;};structpeople{charname[20];charpasspart[20];intticket;intid;intnumber;structpeople*next;};classf

2、ly{public:voidadd();node*read();intselect();voidupdate();voidupdate_ticket(intid,intu_id);ofstreamwe;ifstreamre;private:node*head;};classuser:publicfly{public:intadd();intinsert();voiddele();intuser_id;};#endif#include"iostream"#include"flight.h"#include"fstream"usingnamespacest

3、d;voidfly::add(){inti;node*p=newnode;node*s,*n;head=p;we.open("flight.txt",ios_base::app

4、ios_base::binary);cout<<"请依次输入航班信息:"<>p->id>>p->start>>p->over>>p->s_time>>p->o_time>>p->price>>p->sale>>p->ticket;while(p!=NULL){cout<<"是否再次输

5、入?1是2否"<>i;if(i==1){s=newnode;cin>>s->id>>s->start>>s->over>>s->s_time>>s->o_time>>s->price>>s->sale>>s->ticket;p->next=s;p=s;p->next=NULL;}else{p->next=NULL;p=p->next;}}n=head;while(n!=NULL){we.write(reinterpret_cast(n),sizeof(structnode));n=n->next;}we.close()

6、;cout<<"录入成功"<

7、ios_base::in);node*h,*s,*p;h=newnode;p=newnode;p->next=NULL;re.read(reinterpret_cast(p),sizeof(structnode));h->next=p;while(!re.eof()){s=newnode;re.read(reinterpret_cast(s),sizeof(structnod

8、e));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起飞城市查找?"<>i;if(i==1){cout<<"请输入航班号"<>i;for(;;){if(p->id==i){cout<<"航班号"<id<<"起飞地"<start<<"目的地"<over<<"起飞时间"<s_time<<"降落

9、时间"<o_time<<"票价"<price<<"折扣"<sale<<"票数"<ticket<ticket;break;}if(p->next==NULL){cout<<"查无次航班信息"<next;}i=0;}if(i==2){charove[20];cout<<"请输入抵达城市"<>ove;for(;;){if(strcmp(p->over,ove)==0){cout<<"航班号"<id<<"起飞地"<start<<

10、"目的地"<over<<"起飞时间"<s_time<<"降落时间"<o

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

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

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