資源簡介
數據結構結課時要求交的模擬停車場管理系統期末設計23333
代碼片段和文件信息
#include
#include“linkQueue.h“
#include“SqList.h“
int?main(int?argc?char**?argv)
{
????linkQuNode?*q1*q2*q3;//隊列
????SqList?*L;//鏈表
InitQueue(q1);//進隊
InitQueue(q2);//出隊結算
InitQueue(q3);//出隊結算
InitList(L);//鏈表
int?i;
ElemType?e;//表自定類型對象?
ElemType1?e1e2e3;//隊列自定類型對象?
int?x11[]={110111112113114115116};//車位重復性檢測?
int?x22[]={1234567};//車牌檢測?
peo?x33[7];//一開始進場6輛車?
for(int?j=0;j<6;j++){
x33[j].place=x11[j];
x33[j].num=x22[j];
x33[j].time=0;?
}
CreateList(Lx336);//初始6輛車
cout<<“===========歡迎使用slyarh的停車場===========“< cout<<“??????????本停車場最多可停放7輛汽車“< while(i!=4){
cout<<“================slyarh的系統================“< cout<<“?????????????當前已停放“< DispList(L);
cout<<“您可以選擇:“< cout<<“?1:入站“<<“??“<<“2:出站“<<“??“<<“3:出庫汽車計費“<<“??“<<“4:退出系統“< cout<<“請選擇:“;
cin>>i;
switch(i){
case?1:
if(ListLength(L)==7){//停車場順序表長度滿7
????if(QueueLength(q1)==3)??cout<<“?????目前停車場已滿,還請另尋他處停車~“< ????else?if(QueueLength(q1)!=3){
???? cout<<“?????目前停車場已滿,還請在通道內等待~“< Gettt1(e);//車牌?
e1=e.num;
EnQueue(q1e1);//進隊等
}
}
????else{
???? if(ListLength(L)==0)??cout<<“?????????您是本停車場的第一位顧客^v^“< ???? else{
???? cout<<“當前已被使用的車位有:“;
for(int?x=0;x ????for(int?y=0;y<7;y++){
????????if(L->data[x].place==x1[y])??cout< ????}
????}
}
cout< Get1(e);//獲取車牌車位時間?
ListInsert(LListLength(L)+1e);//插入停車場?
}
cout<<“當前停放的車輛有:“< DispList(L);//顯示停的車?
if(!QueueEmpty(q1)){//候車區非空?
cout<<“當前候車區停放的車輛有:“< DispQueue(q1);
}
else??cout<<“當前候車區暫無車輛~“< if(!QueueEmpty(q2)){//結算區非空?
cout<<“當前等待結算離開的車輛有:“< DispQueue(q2);
}
else??cout<<“當前暫無等待結算離開的車輛~“< break;
case?2:
if(QueueLength(q2)==3)??cout<<“目前等待結算的車輛太多了~待其出庫后您方可出站~!“< else{
if(ListEmpty(L))??cout<<“?????????????沒生意啊好心酸TvT~“< else{
cout< ElemType?i1;
cin>>i1.num;//車牌?
if(ListDelete(LLocateElem(Li1)e)){//查找并刪除,e是被刪的車
????????cout<<“車牌號為“< e2=e.num;//獲取車牌?
EnQueue(q2e2);//進結算隊等
e3=e.time;
EnQueue(q3e3);//獲取該車最開始進入停車場時間
if(!QueueEmpty(q1)){//進隊列非空
????????????DeQueue(q1e1);//出隊(車牌
Getn1(ee1);//車牌獲取
cout<<“車牌為“< Gett(e);//進場時間
ListInsert(LListLength(L)+1e);//插入?
????????????}
else{
???????? ????for(int?x=0;x<7;x++){//車位刪除?
????????if(x1[x]==e.place){
????????x1[x]=0;
break;
}
}
}
????????}
else?cout<<“不存在此車輛哦~請檢查后重新輸入~~“<
評論
共有 條評論