C++版大大数据结构航空订票系统源代码Word文档下载推荐.docx
《C++版大大数据结构航空订票系统源代码Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《C++版大大数据结构航空订票系统源代码Word文档下载推荐.docx(13页珍藏版)》请在冰豆网上搜索。
intselect();
voidupdate();
voidupdate_ticket(intid,intu_id);
ofstreamwe;
ifstreamre;
private:
node*head;
classuser:
publicfly
intadd();
intinsert();
voiddele();
intuser_id;
#endif
#include"
iostream"
flight.h"
fstream"
voidfly:
:
add()
inti;
node*p=newnode;
node*s,*n;
head=p;
we.open("
flight.txt"
ios_base:
app|ios_base:
binary);
cout<
<
"
请依次输入航班信息:
endl;
航班号起飞地目的地起飞时间降落时间票价折扣票数"
cin>
>
p->
id>
start>
over>
s_time>
o_time>
price>
sale>
ticket;
while(p!
=NULL)
{
cout<
是否再次输入?
1是2否"
cin>
i;
if(i==1)
{
s=newnode;
cin>
s->
p->
next=s;
p=s;
next=NULL;
}
else
p=p->
next;
}
n=head;
while(n!
we.write(reinterpret_cast<
char*>
(n),sizeof(structnode));
n=n->
we.close();
录入成功"
}
node*fly:
read()
re.open("
binary|ios_base:
in);
node*h,*s,*p;
h=newnode;
p=newnode;
p->
re.read(reinterpret_cast<
(p),sizeof(structnode));
h->
next=p;
while(!
re.eof())
s=newnode;
re.read(reinterpret_cast<
(s),sizeof(structnode));
p->
p=s;
re.close();
returnh;
intfly:
select()
node*p,*h;
h=read();
p=h->
您是要按1航班号2抵达城市3起飞城市查找?
if(i==1)
请输入航班号"
for(;
;
)
if(p->
id==i)
{
cout<
航班号"
id<
起飞地"
start<
目的地"
over<
起飞时间"
s_time<
降落时间"
o_time<
票价"
price<
折扣"
sale<
票数"
ticket<
returnp->
break;
}
next==NULL)
查无次航班信息"
i=0;
if(i==2)
charove[20];
请输入抵达城市"
ove;
if(strcmp(p->
over,ove)==0)
return-1;
if(i==3)
charsta[20];
请输入起飞城市"
sta;
start,sta)==0)
return-1;
update()
node*p,*n,*h;
请输入您要修改的航班信息的航班号"
for(;
if(p->
cout<
请输入修改后的航班信息:
break;
查无此航班信息"
p=p->
n=h->
trunc|ios_base:
修改成功"
update_ticket(intid,intu_id)
id==u_id)
ticket=p->
ticket-id;
intuser:
people*p=newpeople;
user.txt"
请依次输入订票信息:
客户姓名证件号订票数量航班号订单编号"
name>
passpart>
ticket>
number;
we.write(reinterpret_cast<
(p),sizeof(structpeople));
user_id=p->
id;
returnp->
insert()
intticket,id;
ticket=select();
if(ticket==-1)
请再次查询确定航班号"
else
if(ticket==0)
该航班无票"
id=add();
returnid;
voiduser:
dele()
intnum;
people*h,*s,*p,*n,*m;
h=newpeople;
p=newpeople;
s=newpeople;
(s),sizeof(structpeople));
}
请输入您要删除的客户订单编号"
num;
m=h;
if(n->
number==num)
m->
next=n->
p=h->
删除成功"
m=m->
intmain()
usera;
flyb;
inti,s,id;
欢迎进入航班订票系统"
请选择:
1航班信息管理2订票信息管理3退出"
请选择您要实施的操作;
system("
CLS"
);
switch(i)
case1:
1添加航班信息2查找航班信息3修改航班信息4返回上一层"
s;
system("
switch(s)
case1:
b.add();
case2:
a.select();
case3:
a.update();
default:
system("
break;
case2:
1添加订票信息2删除订票信息3返回上一层"
id=a.insert();
a.update_ticket(id,a.user_id);
a.dele();
case3:
return0;