資源簡介
有完整的資料,有設計報告~!
(1)、查詢航線:根據旅客提出的終點站名輸出如下信息:航班號、飛機號、星期幾飛行,最近一天航班的日期和余票額;
(2)、承辦訂票業務:根據客戶提出的要求(航班號、訂票數額)查詢該航班票額情況,若有余票,則為客戶辦理訂票手續,輸出座位號;若已滿員或余票額少于訂票額,則需重新詢問客戶要求。若需要,可登記排隊候補;
(3)、承辦退票業務:根據客戶提供的情況(日期、航班),為客戶辦理退票手續,然后查詢該航班是否有人排隊候補,首先詢問排在第一的客戶,若所退票額能滿足他的要求,則為他辦理訂票手續,否則依次詢問其他排隊候補的客戶。

代碼片段和文件信息
#include?“common.h“
#include?
#include?
#include?
void?Release(Flight?*head)
{
Flight?*p=head;
Client?*q;
while(p!=NULL)
{
q=p->bookedClient;
while(q!=NULL)
{
p->bookedClient=p->bookedClient->next;
free(q);
q=p->bookedClient;
}
q=p->waitForRetClient->front;
while(q!=NULL)
{
p->waitForRetClient->front=p->waitForRetClient->front->next;
free(q);
q=p->waitForRetClient->front;
}
head=head->next;
free(p);
p=head;
}
}
Flight?*LoadFlight(Flight?*head)
{
Flight?*p=head;
Client?*q;
ReserverData?*resveredData=NULL?*waitForRetClientData=NULL;
FILE?*pFile=fopen(“Flight.dat““r“);
resveredData=LoadClientDate(resveredData0);//0:已訂票的客戶
waitForRetClientData=LoadClientDate(waitForRetClientData1);//1:等候訂票的客戶
if(pFile!=NULL)
{
while(!feof(pFile))
{
p=(Flight?*)malloc(sizeof(Flight));
p->bookedClient=NULL;
if(fread(psizeof(Flight)-sizeof(Flight?*)1pFile)!=0)
{
p->bookedClient=FindClientByFlightID(resveredDatap->ID);
p->bookedClient=SortClient(p->bookedClient);
p->waitForRetClient=(linkqueue?*)malloc(sizeof(linkqueue));
q=FindClientByFlightID(waitForRetClientDatap->ID);
FormQueue(p->waitForRetClientq);
p->next=head;
head=p;
}
}
fclose(pFile);
}
return?head;
}
void?FormQueue(linkqueue?*queueClient?*client)
{
Client?*q=client;
init(queue);
while(q!=NULL)
{
client=client->next;
enqueue(queueq);
q=client;
}
}
ReserverData?*LoadClientDate(ReserverData?*headint?type)
{
ReserverData?*p=head*q;
Client?*t;
FILE?*pFile;
if(type?==?0)
pFile=fopen(“Reserve.dat““r“);
if(type?==?1)
pFile=fopen(“WaitForRet.dat““r“);
if(pFile!=NULL)
{
while(!feof(pFile))
{
t=(Client?*)malloc(sizeof(Client));
if(fread(tsizeof(Client)-sizeof(Client?*)1pFile)!=0)
{
p=head;
while(p!=NULL)
{
if(!strcmp(p->pClient->FlightIDt->FlightID))
break;
p=p->next;
}
if(p!=NULL)
{//同一航班號的已發現從節點頭插入
t->next=p->pClient;
p->pClient=t;
}
else
{//同一航班號的沒發現
q=(ReserverData?*)malloc(sizeof(ReserverData));
q->pClient=NULL;
t->next=q->pClient;
q->pClient=t;
//將新建的ReserverData節點加入ReserverData?*head
q->next=head;
head=q;
}
}
}
fclose(pFile);
}
return?head;
}
Client?*FindClientByFlightID(ReserverData?*headchar?FligntID[])
{
ReserverData?*p=head;
Client?*qHead=NULL;
while(p!=NULL)
{
/* if(!strcmp(p->pClient->FlightIDFligntID))
{//找到一個
p->pClient->next=qHead;
qHead=p->pClient;
}*/
if(!strcmp(p->pClient->FlightIDFligntID))
break;
p=p->next;
}
//return?qHead;
if(p!=NULL)
return?p->pClient;
else
return?NULL;
}
Flight?*AppendFlight(Flight?*head)
{
Flight?*p;
p=(Flight?*)malloc(sizeof(Flight));
printf(“\t\t航班號:“);
scanf(“%s“p->ID);
printf(“\t
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????36094??2009-05-18?22:01??航空訂票模擬系統\Debug\common.obj
?????文件??????????0??2009-05-18?22:01??航空訂票模擬系統\Debug\common.sbr
?????文件???????1041??2009-05-16?16:23??航空訂票模擬系統\Debug\Flight.dat
?????文件?????213073??2009-05-18?22:01??航空訂票模擬系統\Debug\main.exe
?????文件??????13761??2009-05-18?21:53??航空訂票模擬系統\Debug\main.obj
?????文件?????590848??2009-05-18?22:01??航空訂票模擬系統\Debug\main.pdb
?????文件??????????0??2009-05-18?21:53??航空訂票模擬系統\Debug\main.sbr
?????文件???????1587??2009-05-18?21:53??航空訂票模擬系統\Debug\queue.obj
?????文件??????????0??2009-05-18?21:53??航空訂票模擬系統\Debug\queue.sbr
?????文件??????????0??2009-05-16?16:23??航空訂票模擬系統\Debug\Reserve.dat
?????文件??????69632??2009-05-18?22:01??航空訂票模擬系統\Debug\vc60.pdb
?????文件??????????0??2009-05-16?16:23??航空訂票模擬系統\Debug\WaitForRet.dat
?????文件??????12329??2009-05-18?22:00??航空訂票模擬系統\common.c
?????文件???????1680??2009-05-15?10:51??航空訂票模擬系統\common.h
?????文件????????208??2009-05-18?22:01??航空訂票模擬系統\Flight.dat
?????文件???????1180??2009-05-18?17:53??航空訂票模擬系統\main.c
?????文件???????3500??2009-05-18?22:01??航空訂票模擬系統\main.dsp
?????文件????????516??2009-05-18?18:46??航空訂票模擬系統\main.dsw
?????文件??????58368??2009-05-18?22:01??航空訂票模擬系統\main.ncb
?????文件??????48640??2009-05-18?22:01??航空訂票模擬系統\main.opt
?????文件???????1761??2009-05-18?22:01??航空訂票模擬系統\main.plg
?????文件?????????40??2009-05-15?07:32??航空訂票模擬系統\queue.c
?????文件????????175??2009-05-15?07:32??航空訂票模擬系統\queue.h
?????文件??????????0??2009-05-18?22:01??航空訂票模擬系統\Reserve.dat
?????文件??????????0??2009-05-18?22:01??航空訂票模擬系統\WaitForRet.dat
?????文件?????465920??2009-07-02?17:56??航空訂票模擬系統\設計報告.doc
?????文件??????????0??2009-05-19?13:17??航空訂票模擬系統\執行文件是Debug里面的main.exe.txt
?????目錄??????????0??2009-11-02?16:09??航空訂票模擬系統\Debug
?????目錄??????????0??2009-11-02?16:09??航空訂票模擬系統
-----------?---------??----------?-----??----
............此處省略2個文件信息
- 上一篇:DataGridView 顯示數組中的元素
- 下一篇:SBUS的解析與合成
評論
共有 條評論