資源簡介
航空訂票系統航空訂票系統航空訂票系統航空訂票系統航空訂票系統航空訂票系統航空訂票系統航空訂票系統航空訂票系統航空訂票系統

代碼片段和文件信息
#include
#include
#include
#include
#define?NULL?0
struct?airline????????//定義一個airline的結構體
{
char?line[8];
char?plane[8];
char?end[20];
int?total;
int?left;
struct?airline?*next;??
}airline;?
?struct?customer??????//定義一個customer的結構體
{?
char?name[9];
char?line[8];
int?seat;
struct?customer?*next;
}customer;?
struct?airline?*chushihua_airline()?//初始化airline鏈表的函數
{?
?struct?airline?*l;?
l=(struct?airline*)malloc(sizeof(struct?airline));?
if(l==NULL)?
?exit(0);?
l->next=NULL;?
return?l;?
}?
struct?customer?*chushihua_customer()???//初始化customer鏈表的函數
{?
struct?customer?*l;?
l=(struct?customer*)malloc(sizeof(struct?customer));?
if(l==NULL)
exit(0);?
l->next=NULL;?
return?l;?
}?
int?insert_airline(struct?airline?**pchar?*linechar?*planechar?*endint?totalint?left)?//插入航班信息的函數
{?
struct?airline?*q;?
q=(struct?airline*)malloc(sizeof(struct?airline));?
strcpy(q->lineline);?
strcpy(q->planeplane);?
strcpy(q->endend);?
q->total?=total;?
q->left?=left;?
q->next=NULL;?
(*p)->next=q;?
(*p)=(*p)->next;??
return?1;?
}?
int?insert_customer(struct?customer?**pchar?*namechar?*lineint?seat)???//插入顧客信息的函數
{?
struct?customer?*q;?
q=(struct?customer*)malloc(sizeof(struct?customer));??
strcpy(q->namename);?
strcpy(q->lineline);?
q->seat?=seat;?
q->next=NULL;?
(*p)->next=q;?
(*p)=(*p)->next;??
return?1;?
}?
int?creat_airline(struct?airline?**l)???//創建airline的函數
{?struct?airline?*p=*l;?
int?i=0;?
char?*line[3]={“bjnc01““bjsh02““shgz03“};?
char?*plane[3]={“plane1““plane2““plane3“};?
char?*end[3]={“nc““sh““gz“};?
int?total[3]={100100100};?
int?left[3]={515078};?
for?(i=0;i<3;i++){?
insert_airline(&pline[i]plane[i]end[i]total[i]left[i]);?
}?
return?1;?
}?
int?creat_customer(struct?customer?**l)???//創建customer的函數
{?struct?customer?*p=*l;?
int?i=0;?
char?*name[3]={“陳寧““張紅““趙敏“};?
char?*line[3]={“bjnc01““bjsh02““shgz03“};?
int?seat[3]={1510};?
for?(i=0;i<3;i++){?
insert_customer(&pname[i]line[i]seat[i]);?
}?
return?1;?
}?
?
int?book(struct?airline?*lchar?*linestruct?customer?*cchar?*name)???//訂票函數?
{?struct?airline?*p=l;?
struct?customer?*q=c->next?;?
p=l->next?;?
for(;q->next?!=NULL;q=q->next)
{}?
for(;p!=NULL;p=p->next?)?
{?if(strcmp(linep->line?)==0)?
{?if(p->left?>0)?
{printf(“恭喜您訂票成功!\n“);?
printf(“你的座位號是:?%d\n“(p->total?-p->left?+1));?
insert_customer(&qnamelinep->total?-p->left?+1);?
p->left?--;?
return?1;?
}?
else?printf(“對不起座位已滿!\n“);?
return?0;?
}?
}?
printf(“對不起沒有這個航班號!\n“);?
return?0;?
}?
struct?airline?*change_airline(struct?airline?*lchar?*line)
{struct?airline?*p;?
p=l->next?;?
for(;p!=NULL;p=p->next?)?
{?if(strcmp(linep->line)==0)?
{?p->left?++;??
return?l;?
}?
}?
printf(“沒有這個航班,無法完成修改任務!\n“);?
return?0;?
}?
int?delete_cus(struct?customer?*hstruct?airline?*lchar?*name)????//退票函數
{struct?customer?*p*pr;?
char?line[8];??
pr=h;?
p=pr->next?;??
while(p!
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????12311??2010-08-16?14:51??航空訂票系統\1.cpp
?????文件???????3341??2010-08-19?23:42??航空訂票系統\1.dsp
?????文件????????527??2010-08-19?23:44??航空訂票系統\1.dsw
?????文件??????50176??2010-08-19?23:44??航空訂票系統\1.ncb
?????文件??????48640??2010-08-19?23:44??航空訂票系統\1.opt
?????文件????????236??2010-08-19?23:42??航空訂票系統\1.plg
?????文件?????????75??2010-08-19?23:44??航空訂票系統\airline.dat
?????文件?????????55??2010-08-19?23:44??航空訂票系統\customer.dat
?????文件?????200790??2010-08-16?15:02??航空訂票系統\Debug\1.exe
?????文件?????244228??2010-08-16?15:02??航空訂票系統\Debug\1.ilk
?????文件??????39491??2010-08-16?15:02??航空訂票系統\Debug\1.obj
?????文件?????228112??2010-08-16?14:15??航空訂票系統\Debug\1.pch
?????文件?????492544??2010-08-16?15:02??航空訂票系統\Debug\1.pdb
?????文件??????41984??2010-08-19?23:43??航空訂票系統\Debug\vc60.idb
?????文件??????53248??2010-08-16?15:02??航空訂票系統\Debug\vc60.pdb
?????文件?????200782??2009-08-08?22:39??航空訂票系統\Debug\航空訂票系統.exe
?????文件?????220252??2009-08-08?22:39??航空訂票系統\Debug\航空訂票系統.ilk
?????文件?????228112??2009-08-08?22:39??航空訂票系統\Debug\航空訂票系統.pch
?????文件?????492544??2009-08-08?22:39??航空訂票系統\Debug\航空訂票系統.pdb
?????文件???????4345??2009-08-08?22:40??航空訂票系統\航空訂票系統.dsp
?????文件????????532??2009-08-08?22:39??航空訂票系統\航空訂票系統.dsw
?????文件??????33792??2009-08-08?22:40??航空訂票系統\航空訂票系統.ncb
?????文件??????48640??2009-08-08?22:40??航空訂票系統\航空訂票系統.opt
?????文件????????258??2009-08-08?22:40??航空訂票系統\航空訂票系統.plg
?????目錄??????????0??2010-08-16?15:02??航空訂票系統\Debug
?????目錄??????????0??2010-08-19?23:44??航空訂票系統
-----------?---------??----------?-----??----
??????????????2645015????????????????????26
評論
共有 條評論