航空客运订票系统源代码Word下载.docx
- 文档编号:5220083
- 上传时间:2023-05-04
- 格式:DOCX
- 页数:22
- 大小:19.87KB
航空客运订票系统源代码Word下载.docx
《航空客运订票系统源代码Word下载.docx》由会员分享,可在线阅读,更多相关《航空客运订票系统源代码Word下载.docx(22页珍藏版)》请在冰点文库上搜索。
//指针域
}*houbucustomer;
structLinkQueue
{
houbucustomerfront,rear;
//队头队尾指针
//航线结构体
structairline{
charplane_num[8];
//飞机号
charend_place[20];
//目的的
charfly_data[20];
//飞行周日
inttotal;
//座位总数
intleft;
//剩余座位
Linkcustomercustom;
//订票顾客指针
LinkQueuehoubucus;
//候补顾客指针
structairline*next;
//下一个结点
typedefairline*Linkairline;
//初始化航线链表
voidinit_airline(Linkairline&
l){
l=newairline[sizeof(airline)];
//产生头结点,并始l指向此头结点
if(!
l){//存储分配失败
exit(0);
//退出
}
l->
next=NULL;
//头结点的指针域为空
}
//初始化顾客链表(同初始化航线链表)
voidinit_customer(Linkcustomer&
l=newcustomer[sizeof(customer)];
//初始化候补顾客队列链表(同初始化航线链表)
voidinit_houbucustomer(LinkQueue&
Q){
Q.front=Q.rear=newhoubuNode[sizeof(houbuNode)];
//
Q.front){
Q.front->
//判断airline链表是否为空
statusairLineEmpty(LinkairlineL)
if(L->
next)//非空
returnFALSE;
else
returnTRUE;
//airline链表插入操作
statusinsert_airline(LinkairlineL,inti,char*line_num,char*plane_num,char*end_place,char*fly_data,inttotal,intleft,Linkcustomercustom,LinkQueuehoubucus){
intj=0;
//计数器
Linkairlines,p=L;
//p指向头结点
while(p&
&
j<
i-1)//寻找第i-1个结点
{
j++;
p=p->
next;
p||j>
i-1)//i小于1或大于表长
returnERROR;
//插入失败
s=newairline[sizeof(airline)];
//生成新结点
strcpy(s->
line_num,line_num);
//给新结点赋值
plane_num,plane_num);
end_place,end_place);
fly_data,fly_data);
s->
total=total;
left=left;
custom=custom;
houbucus=houbucus;
next=p->
//新结点指向原第i个结点
p->
next=s;
//原第i-1个结点指向新结点
returnOK;
//插入成功
//customer链表插入操作(同airline链表插入操作)
statusinsert_customer(LinkcustomerL,inti,char*name,char*line_num,intpiaonum){
Linkcustomers,p=L;
i-1)
s=newcustomer[sizeof(customer)];
name,name);
piaonum=piaonum;
//houbucustomer入队操作
voidinsert_houbucustomer(LinkQueue&
Q,char*name,char*end_place,intpnum){
houbucustomerp;
p=newhoubuNode[sizeof(houbuNode)];
strcpy(p->
pnum=pnum;
Q.rear->
next=p;
Q.rear=p;
//houbucustomer出队操作
statusdel_houbucustomer(LinkQueue&
Q,houbuNode&
hbnode){
p=Q.front->
strcpy(hbnode.name,p->
name);
strcpy(hbnode.end_place,p->
end_place);
hbnode.pnum=p->
pnum;
if(Q.rear==p)
Q.rear=Q.front;
deletep;
//houbucustomer输出操作
voidprint_houbucustomer(LinkQueueQ)
houbucustomerp=Q.front->
cout<
<
"
候补顾客为:
endl;
姓名终点站票数"
while(p)
cout<
p->
name<
"
end_place<
"
//打印航线信息
statusprint_airline(Linkairlinel)
endl<
航班号飞机号目的地飞行周日总票数余票数订票客户替补客户"
Linkairlinep=l->
next;
for(;
p!
=NULL;
p=p->
next)
setiosflags(ios:
:
left)<
setw(9);
line_num<
setw(10)<
plane_num<
setw(9)<
end_place
<
setw(12)<
fly_data<
total<
setw(8)<
left<
setw(12)<
(p->
houbucus)<
custom)<
//打印航线信息(print_airline重载)
statusprint_airline(Linkairlinel,stringname,intN)
stringinfo;
boolflag=true;
if(N==1)
info=p->
end_place;
else
line_num;
if(info==name)
{
flag=false;
cout<
//输出格式控制
<
break;
}
if(flag)
对不起,没有终点站为"
的航班"
对不起,没有航班号为"
//打印顾客信息
statusprint_customer(Linkcustomerl)
Linkcustomerp=l->
left);
piaonum<
//航班信息录入
statusaddmoreairline(Linkairlinel,Linkcustomercustom,LinkQueuehoubucus)
charline_num1[8],plane_num1[8],fly_data1[8],end_place1[8];
inttotal1=100,left1=80;
请输入以下信息:
航班号:
;
cin>
>
line_num1;
飞机号:
plane_num1;
目的地:
end_place1;
飞行周日:
fly_data1;
总票数:
total1;
余票数:
left1;
insert_airline(l,airnum,line_num1,plane_num1,end_place1,fly_data1,total1,left1,custom,houbucus);
airnum++;
添加成功!
print_airline(l);
//修改airline链表中的数据
statusmodefy_airline(Linkairlinel,char*line_num)
if(strcmp(line_num,p->
line_num)==0)
left++;
没有这个航班,无法完成修改任务!
returnERROR;
//订票
statusbook(Linkairlinel,char*end_place,Linkcustomerc,char*name,
intnum,LinkQueuehoubu)
//p指向第一个结点
Linkcustomerq=c->
//q指向第一个结点
next)//查找
if(strcmp(end_place,p->
end_place)==0)
if(p->
left-num>
=0)//剩余票数大于订票数
订票成功!
insert_customer(c,cusnum,name,p->
line_num,num);
//向顾客链表插入记录
left-=num;
//订票成功,剩余票数减少
cusnum++;
//顾客数加一
else//剩余票数小于订票数
{
charpd;
cout<
对不起,余票不足!
是否需要排队候补(Y/N):
cin>
pd;
if(pd=='
Y'
||pd=='
y'
)//需要排队候补
{
insert_houbucustomer(houbu,name,end_place,num);
//向候补队列插入记录
cout<
候补登记成功!
print_houbucustomer(houbu);
}
else
{}
}
return0;
对不起,没有终点站为"
的航班!
//退票
statusdelete_cus(Linkcustomerh,Linkairlinel,char*name,LinkQueuehoubu)
{
Linkcustomerp=h->
next,pr=h;
//p指向顾客链表首结点
houbuNodehbnode;
while(p!
=NULL)//循环查找退票顾客
if(strcmp(name,p->
name)==0)
strcpy(line_num,p->
line_num);
for(inti=0;
i<
piaonum;
i++)//更改该航线的剩余票数
modefy_airline(l,line_num);
pr->
next=p->
顾客"
退票成功!
cusnum--;
//顾客数减一
if(houbu.front->
next==NULL)
else
{
del_houbucustomer(houbu,hbnode);
//候补顾客出队
if(l->
next->
left>
=hbnode.pnum)//剩余票数多于排在第一位的客户订的票数
//为排在第一位的客户办理订票业务
book(l,hbnode.end_place,h,hbnode.name,hbnode.pnum,houbu);
候补顾客"
hbnode.name<
else//剩余票数少于排在第一位的客户订的票数
票数仍然不足!
pr=pr->
p=pr->
无此顾客,无法退票!
//未查到顾客信息
//打开进度条,程序信息简介
voidopen()
\n\n\n\n课程设计\n"
\n╔-------------------------------╗"
\n││"
\n│名称:
航空订票系统│"
\n││"
\n│作者:
乐升平│"
\n│学号:
6│"
\n│班级:
12计科
(2)班│"
\n││"
\n│工具:
VC++6.0C++语言│"
\n╚-------------------------------╝\n"
system("
pause"
);
cls"
\n\n\n\n\n\n****************欢迎使用航空订票系统**************\n\n\n"
constintM=25;
intk;
\n〓程序加载中>
for(k=1;
k<
=M;
k++)
■"
Sleep(100);
【载入完成】\a"
前言"
欢迎使用『航空订票系统』,本程序实现了以下功能:
\n\n"
①录入功能:
可以录入航班情况\n\n"
②查询功能:
根据客户提供的终点站名或航班号进行查询。
③订票功能:
根据客户提出的要求及实际情况为客户办理订票手续,且跟据需要\n\n"
可登记排队候补。
④退票功能:
根据客户提供的情况为客户办理退票手续,若有候补订票顾客还可\n\n"
为排在第一位的客户办理订票手续。
}
//主函数
intmain()
open();
charchoice,name[9],end_place[10];
intt=1,num;
Linkairlineair;
Linkcustomercustomer;
LinkQueuehoubu;
init_airline(air);
//初始化airline链表
init_customer(customer);
//初始化customer链表
init_houbucustomer(houbu);
//初始化houbucustomer队列
while(t==1)//进入菜单
system("
\n\n****************欢迎使用航空订票系统***************\n\n"
请选择菜单\n\n"
1录入\n\n"
2订票\n\n"
3退票\n\n"
4查询\n\n"
0退出\n\n"
请选择:
cin>
choice;
switch(choice)
case'
1'
{//航班信息录入
system("
addmoreairline(air,customer,houbu);
//录入航班信息
2'
{//订票
if(airLineEmpty(air))//订票前航班信息为空
ERROR!
请先输入航线信息!
请输入你要订的终点站名:
请输入你的姓名:
name;
请输入你的订票数量:
num;
book(air,end_place,customer,name,num,h
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 航空 客运 订票 系统 源代码