资源简介
事实上事实上飞机订票系统,c ++编写,不错的资源
代码片段和文件信息
#include
#include
struct banci
{int day;
int excess;
banci *ne*be;
};
struct waybill
{char name[20];
int day;
waybill *ne*be;
};
void createbancilist(banci *& head)
{banci *s *p;
s=new banci;
cout<<“请输入航班起飞的时间和剩余机票,时间和剩余机票用空格分开“< cin>>s->day>>s->excess;
while(s->day!=0)
{if(head==NULL)
{
head=s;
s->ne=s->be=s;
p=s;
}
s->ne=head;
s->be=p;
p->ne=s;
head->be=s;
p=s;
s=new banci;
cin>>s->day>>s->excess;
}
delete s;
return;
}
void showbanci(banci *&head1)
{cout<<“班次的信息是:“< cout<<“时间“<<“ “<<“剩余票数“< banci *p=head1;
do
{cout<day<<“号“<<“ “<excess< p=p->ne;
}while(p!=head1);
}
void createwaybilllist(waybill *& head1banci *&head2)
{waybill *p*s;
banci *a=head2;
s=new waybill;
cout<<“请输入购票者的信息,名字在前面,起飞日期在后面,如果没有需要输入的信息,请以“0 0”结束“< cin>>s->name>>s->day;
while (s->day!=0)
{ if(a->day==s->day) {cout<<“订票成功“< (a->excess)--;
goto a;}
a=a->ne;
while((a->day!=s->day)&&(a!=head2))
a=a->ne;
if(a==head2) {cout<<“我们没有那天的票,订票失败“< goto A;}
(a->excess)--;
cout<<“订票成功,请继续订票,如果不需要订票,请以“0 0”结束“<
a: if(head1==NULL)
{
head1=s;
s->ne=s->be=s;
p=s;
}
s->ne=head1;
s->be=p;
p->ne=s;
head1->be=s;
p=s;
s=new waybill;
cin>>s->name>>s->day;
}
A: delete s;
return;
}
void showwaybill(waybill *& head)
{cout<<“购票者的信息是“< cout<<“名字“<<“ “<<“飞机的起飞日期“< waybill *p=head;
do
{cout<name<<“ “<day< p=p->ne;
}while(p!=head);
}
void tuipiao(waybill *& headchar a[20])
{waybill *p;
p=head;
if(strcmp(p->namea)==0)
{
head=head->ne;
p->be->ne=head;
head->be=p->be;
cout<<“退票成功“< delete p;
goto B;
}
p=p->ne;
while((strcmp(p->namea)!=0)&&(p!=head))
p=p->ne;
if(p==head) {cout<<“您没有订票,退票失败“< goto B;}
head=head->ne;
p->be->ne=head;
head->be=p->be;
cout<<“退票成功“< delete p;
B: return;
}
void main()
{banci *head1=NULL;
waybill *head2=NULL;
int a;
char b[20];
B: cout<<“**************************欢迎使用广州到北京的航班软件**************************\n请输入:\n1 初始化本次航班本月起飞的日期,建立本航班的日程表\n2 购票\n3 退票\n4 查看航班日程表\n5 查看乘客名单\n6 返回\n7 退出“< cin>>a;
switch(a)
{case 1 : createbancilist(head1);goto B;
case 2 : createwaybilllist(head2head1 );goto B;
case 3 : cout<<“请输入您要退票的人的名字“< cin>>b;
tuipiao(head2b);goto B;
case 4 : showbanci(head1);goto B;
case 5 : showwaybill(head2);goto B;
case 6 : goto B;
default : cout<<“欢迎使用“<<
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 213037 2008-03-17 18:36 飞机班次程序\Cpp1.exe
文件 3250 2008-03-17 18:35 飞机班次程序\Cpp1.cpp
文件 2624094 2008-03-18 10:50 飞机班次程序\1.bmp
文件 1980410 2008-03-18 10:53 飞机班次程序\2.bmp
文件 1758990 2008-03-18 10:55 飞机班次程序\3.bmp
目录 0 2008-03-17 18:39 飞机班次程序
----------- --------- ---------- ----- ----
6579781 6
- 上一篇:c++类声明和成员函数分离写法
- 下一篇:小型超市管理系统(C++)
评论
共有 条评论