91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

航線信息:終點站名、航班號、飛機號、飛行日(星期幾)、乘員定額、余票量、已訂票的客戶名單(包括姓名、訂票量、艙位等級1,2或3)以及等候替補的客戶名單(包括姓名、所需票量)。
系統實現如下功能:
(1) 查詢:根據旅客提出的終點站名輸出信息(例如航班號、飛機號、星期幾飛行,最近一天航班的日期和余票額等);
(2) 訂票:根據客戶提出的要求(航班號、訂票數額)查詢該航班票額情況,若尚有余票,則為客戶辦理訂票手續;若已滿員或剩余票額少于定票額,則需重新詢問客戶要求。若無票,可登記排隊候補或提供相關可選擇航班;
(3) 退票:根據客戶提供的情況(日期、航班),為客戶辦理退票手續,然后查詢該航班是否有人排隊候補,首先詢問排在第一的客戶,若所退票額能滿足他的要求,則為他辦理訂票手續,否則依次詢問其他排隊候補的客戶;
(4) 修改航班信息:當航班信息改變可以修改航班數據文件。


代碼中用了數據結構中的線性表、哈希表、二分查找樹等知識,代碼上傳前已經運行過,絕對可行!

資源截圖

代碼片段和文件信息

#include
#include
#include
#include
#define?M?450//定義數組的空間為不可改變的整數
using?namespace?std;
int?main();//申明主函數
struct?flight//航班信息
{char?terminal[10];//終點站名
char?number[10];//航班號
char?id[10];//飛機號
char?date[10];//飛行日期
int?member;//乘員定額
int?rest;//余票量
struct?flight?*?next;//指向下一個節點的指針
};
struct?custom//客戶信息
{char?name[10];//姓名
char?number[10];//航班號
int?count;//數量
int?grade;//艙位等級
struct?custom?*?next;//指向下一個節點的指針
};
struct?flight?*a[M];//flight類型的指針數組
struct?node//二叉樹節點
{?struct?custom?*?base;??
???node?*r;//左孩子
???node?*l;//右孩子
};?
char?ch[100];
int?judge(char?(&ch)[100])
?{
????int?is=0x=0;
????if(strlen(ch)==3)
{for(i=0;i????{
????if(ch[i]>=‘0‘&&ch[i]<=‘9‘)
????s++;
????}
????if(s==strlen(ch))
{for(i=0;i x=x*10+ch[i]-48;
return?x;
}
????else
????return?0;
}
else?return?0;
?}
int?hash(unsigned?long?k)
{return?k%M;}//取余
unsigned?long?hashvalue(char?*str)//將輸入字符串轉換成長整型數返回
{int?il;?
unsigned?long?ret=0;?
unsigned?short?*s;?
if?(str?==?NULL)?return(0);?
l=(strlen(str)+1)/2;?
s=(unsigned?short?*)str;?
for?(i=0;?iret^=(s[i]<<(i&0x0f));?
return(ret);?
}?
void?hashlist()//建立哈希表
{fstream?obj;
flight?*s=new?flight*t=new?flight;
int?i=0val;
obj.open(“d:\\fly.txt“ios::in);//打開航班信息的文件
while(obj>>s->terminal>>s->number>>s->id>>s->date>>s->member>>s->rest)//提取文件信息
{val=hash(hashvalue(s->terminal));
while(a[hash(val)]!=NULL)//如果數組中的元素不為空,建立鏈表
{if(!strcmp(a[hash(val)]->terminals->terminal))
{t=a[hash(val)];
while(t->next)//將節點往下移,直至最后節點
{t=t->next;}
t->next=s;
t=s;
t->next=NULL;//末尾節點的next賦空
break;
}
else?val++;//哈希表沖突,往數組后面的空位移動
}
if(a[hash(val)]==NULL)//如果哈希表中元素為空,賦給從文件中提取的值
{a[hash(val)]=s;
a[hash(val)]->next=NULL;}
s=new?flight;
}
obj.close();//關閉文件
}
void?create(node?*&rootcustom?*&s)?//生成二分查找樹?
{?custom?*t=new?custom;
if(root==NULL)??//當該節點為空時賦值
????{???root=new?node;??
????????root->base=s;
????????root->l=NULL;??
????????root->r=NULL;?
????}??
else?if(hash(hashvalue(s->name))>hash(hashvalue(root->base->name)))
create(root->rs);?//比當前節點小,往左孩子移
else?if(hash(hashvalue(s->name))base->name)))??
create(root->ls);?//比當前節點大,往右孩子移
else?//等于當前節點
{t=root->base;
while(t->next!=NULL)//將節點往下移,直至最后節點
t=t->next;
t->next=s;//到尾部添加形成線性表
t=s;
t->next=NULL;//末尾節點的next賦空
}
}
void?print(node?*&rootchar?*&name)//輸出要查找的值
{custom?*t=new?custom;
if(root!=NULL)//如果節點不為空
{if(root->l!=NULL?&&?hash(hashvalue(name))base->name)))
print(root->lname);//比當前節點小
else?if(root->r!=NULL?&&?hash(hashvalue(name))>hash(hashvalue(root->base->name)))
print(root->rname);//比當前節點大
else?if(hash(hashvalue(name))==hash(hashvalue(root->base->name)))//等于當前節點
{t=root->base;
cout< “票量“<while(t!=NULL)//輸出找到的線性表
{cout<

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????52224??2012-09-05?17:35??niebin\Debug\niebin.exe

?????文件?????465184??2012-09-05?17:35??niebin\Debug\niebin.ilk

?????文件?????584704??2012-09-05?17:35??niebin\Debug\niebin.pdb

?????文件???????8010??2012-09-05?17:35??niebin\niebin\Debug\BuildLog.htm

?????文件?????????65??2012-09-05?17:35??niebin\niebin\Debug\mt.dep

?????文件????????663??2012-09-05?16:24??niebin\niebin\Debug\niebin.exe.embed.manifest

?????文件????????728??2012-09-05?16:24??niebin\niebin\Debug\niebin.exe.embed.manifest.res

?????文件????????621??2012-09-05?17:35??niebin\niebin\Debug\niebin.exe.intermediate.manifest

?????文件?????149805??2012-09-05?17:35??niebin\niebin\Debug\niebin.obj

?????文件?????183296??2012-09-05?17:35??niebin\niebin\Debug\vc90.idb

?????文件?????233472??2012-09-05?17:35??niebin\niebin\Debug\vc90.pdb

?????文件??????19048??2012-09-05?17:35??niebin\niebin\niebin.cpp

?????文件???????3916??2012-08-26?22:21??niebin\niebin\niebin.vcproj

?????文件???????1411??2012-09-05?17:57??niebin\niebin\niebin.vcproj.聶斌-PC.聶斌.user

?????文件????2255872??2012-09-05?18:01??niebin\niebin.ncb

?????文件????????884??2012-08-26?21:49??niebin\niebin.sln

????..A..H.?????12800??2012-09-05?17:57??niebin\niebin.suo

?????目錄??????????0??2012-09-05?18:01??niebin\niebin\Debug

?????目錄??????????0??2012-09-05?18:01??niebin\Debug

?????目錄??????????0??2012-09-05?18:01??niebin\niebin

?????目錄??????????0??2012-09-05?18:01??niebin

-----------?---------??----------?-----??----

??????????????3972703????????????????????21


評論

共有 條評論