停车场管理系统Word文件下载.docx
《停车场管理系统Word文件下载.docx》由会员分享,可在线阅读,更多相关《停车场管理系统Word文件下载.docx(11页珍藏版)》请在冰豆网上搜索。
charnum[10];
structtmintime;
structtmoutime;
doubleexpense;
intlength;
intposition;
};
//////////thestackofcar//////////////////////////////
typedefstruct
carcarlist[MAXNUM];
inttop;
}Seqstack;
voidStackinit(Seqstack*s)
s->
top=-1;
}
intIsempty(Seqstack*s)
if(s->
top==-1)
return1;
else
return0;
intIsfull(Seqstack*s)
top==MAXNUM-1)
voidStackpush(Seqstack*s,carcar1)
if(!
Isfull(s))
{
s->
top++;
carlist[s->
top]=car1;
}
cout<
<
"
it'
sfullnow"
endl;
carStackpop(Seqstack*s)
carcar1;
Isempty(s))
car1=s->
top];
top--;
returncar1;
carStackgettop(Seqstack*s)
//////////thequeueofcarinttunnel//////////////////////////////
structcarnode
cardata;
structcarnode*next;
structcarnodequeue
carnode*head;
carnode*rear;
voidcarnodequeueinit(carnodequeue*q)
(q->
head=(carnode*)malloc(sizeof(carnode))))
failedtomalloc!
exit(0);
q->
rear=q->
head;
head->
next=NULL;
rear->
intcarnodequeueisempty(carnodequeue*q)
if(q->
rear==q->
head)
voidcarnodequeuein(carnodequeue*q,carcc)
carnode*p;
(p=(carnode*)malloc(sizeof(carnode))))
p->
data=cc;
next=p;
rear=p;
carcarnodequeueout(carnodequeue*q)
carcc;
head!
=q->
rear)
p=q->
next;
if(p->
next==NULL)
{
cc=p->
data;
q->
free(p);
}
else
next=p->
returncc;
//////theseparatorofcout//////////////////////////
voidseparator(intn,charch,charnewline)
for(inti=0;
i<
n;
i++)
ch;
if(newline==1)
/////printthetimestruct//////////////////////////////
voidprintdata(structtmgm_data)
cout<
gm_data.tm_mon<
/"
gm_data.tm_mday<
"
gm_data.tm_hour+8<
:
gm_data.tm_min<
gm_data.tm_sec<
/////showpark////////////////////////////////////////
voidshowpark(Seqstack*s)
structtmgm;
theparkinformationisfollow:
separator(40,'
-'
1);
if(Isempty(s))
theparkisempty!
positionnumberintime"
for(inti=0;
=s->
top;
cout<
s->
carlist[i].position<
"
carlist[i].num<
;
printdata(s->
carlist[i].intime);
thetotalis"
top+1<
cars."
if(s->
top==MAXNUM-1)
andtheparkisfullnow!
andtheparkhave"
MAXNUM-1-s->
top<
positionisempty!
////////////////showaisleofcar/////////////////////////////////
voidshowaisle(carnodequeue*q)
carnodequeueisempty(q))
carnode*p;
theailseinformationisfollow:
separator(30,'
numbertheintime"
while(p!
=NULL)
p->
data.num<
printdata(p->
data.intime);
p=p->
theailseisempty!
separator(30,'
//////////////showparkandailse/////////////////////////////
voidshowall(Seqstack*s,carnodequeue*q)
showpark(s);
showaisle(q);
/////////////inpark//////////////////////////////////////////
voidInpark(Seqstack*s,carnodequeue*q)
structtm*gm_data;
time_tseconds;
time(&
seconds);
//getthetime
gm_data=gmtime(&
thenumberofcar"
cin>
>
cc.num;
cc.intime=*gm_data;
Isfull(s)&
&
cc.position=(s->
top)+2;
Stackpush(s,cc);
showpark(s);
elseif(Isfull(s)||!
carnodequeueisempty(q))
theparkiffull,thecarcanonlyparkinttheailse."
cc.position=MAXNUM;
carnodequeuein(q,cc);
showall(s,q);
////////////////theoutpark/////////////////////////////////
voidOutpark(Seqstack*s,carnodequeue*q)
Seqstackp;
charnowtime[10];
inti,pos;
Stackinit(&
p);
theparkisempty,nocarneedtoleave."