成熟丰满熟妇高潮XXXXX,人妻无码AV中文系列久久兔费 ,国产精品一国产精品,国精品午夜福利视频不卡麻豆

您好,歡迎來(lái)到九壹網(wǎng)。
搜索
您的當(dāng)前位置:首頁(yè)數(shù)據(jù)結(jié)構(gòu)-停車場(chǎng)管理程序代碼

數(shù)據(jù)結(jié)構(gòu)-停車場(chǎng)管理程序代碼

來(lái)源:九壹網(wǎng)
?

源程序代碼:

#include

#include

#include

#include

#define MaxSize 5

#define fee 2

#define L 10000

#define M 20000

typedef int ElemType;

ElemType tmpnum=0;

ElemType tmptime=0;

typedef struct {

ElemType car_num[MaxSize];

ElemType car_time[MaxSize];

int top;

}STACK;

typedef struct qnode {

ElemType car_num;

ElemType car_time;

struct qnode *next;

}QTYPT;

typedef struct qptr {

QTYPT *front;

QTYPT *rear;

}SQUEUE;

SQUEUE LQ;

void InitStack(STACK *S){

S->top = -1;

}

int Full(STACK *S){

if(S->top==MaxSize-1){

printf(\"\\n Stack is full! Push\");

return 0;

}

return 1;

}

int Push(STACK *S,ElemType num,ElemType time){

if(S->top==MaxSize-1){

printf(\"\\n Stack is full! Push\");

return 0;

}

S->top++;

S->car_num[S->top]=num;

S->car_time[S->top]=time;

return 1;

}

int Empty(STACK *S){

return (S->top==-1 ? 1:0);

}

int Pop(STACK *S,ElemType *num,ElemType *time){

if(Empty(S)){

puts(\"Stack is free Pop\");

return 0;

}

*num=S->car_num[S->top];

*time=S->car_time[S->top];

S->top--;

return 1;

}

int GetTop(STACK *S,ElemType *num,ElemType *time){

if(Empty(S)){

puts(\"Stack is free Gettop\");

}

*num=S->car_num[S->top];

*time=S->car_time[S->top];

return 1;

}

void InitQueue(SQUEUE *LQ){

QTYPT *p=NULL;

p=(QTYPT *)malloc(sizeof(QTYPT));

p->next=NULL;

LQ->front=LQ->rear=p;

}

int EnQueue(SQUEUE *LQ,ElemType num,ElemType time){

QTYPT *s;

s=(QTYPT *)malloc(sizeof(QTYPT));

s->car_num=num;

s->car_time=time;

s->next=LQ->rear->next;

LQ->rear->next=s;

LQ->rear=s;

return 1;

}

int CountQueue(SQUEUE *LQ){

int i=1;

QTYPT *mfront=NULL;

QTYPT *mrear=NULL;

mfront=LQ->front;

mrear=LQ->rear;

while(!(LQ->front==LQ->rear)){

i++;

LQ->front=LQ->front->next;

}

LQ->front=mfront;

return i;

}

int Empty_Q(SQUEUE *LQ){

return (LQ->front==LQ->rear?1:0);

}

int OutQueue(SQUEUE *LQ,ElemType *num,ElemType *time){

QTYPT *p;

if(Empty_Q(LQ)){

puts(\"Quenue is free OutQuenue\");

return 0;

}

p=LQ->front->next;

*num=p->car_num;

*time=p->car_time;

LQ->front->next=p->next;

if(LQ->front->next==NULL)

LQ->rear=LQ->front;

free(p);

return 1;

}

int GetHead(SQUEUE *LQ,ElemType *num,ElemType *time){

if(Empty_Q(LQ)){

puts(\"Quenue is free GetHead\");

return 0;

}

*num=LQ->front->next->car_num;

*time=LQ->front->next->car_time;

return 1;

}

void sleep(int time){

clock_t goal;

goal=time*(CLOCKS_PER_SEC)+clock();

while(goal > clock())

{

;

}

}

int chackinput(STACK *S,int pnum){

int i=0;

int num;

num = pnum;

i=S->top;

for(;!(i==-1);i--)

if(S->car_num[i]==num)

return 1;

return 0;

}

int chacktime(STACK *S,int ptime){

return S->car_time[S->top] <= ptime ? 1 : 0;

}

int displaystats(STACK *S,int pinput){

void displayhead(void);

int i = 0;

i = S->top;

switch(pinput){

case 10000:

{

if(!Empty(S))

for(;!(i==-1);i--)

printf(\"<===%d時(shí)%d號(hào)else

車停與%d車位

===>\\n\

cout<<\"停車場(chǎng)為空\(chéng)";

printf(\"還有車%d個(gè)位\\n\

break;

}

case 20000:

{

displayhead();

break;

}

default:

{

return 1;

}

}

return 0;

}

void displayhead(void){

cout<<'\\n'<<\"<===============CT===================>\"<停車場(chǎng)管理系統(tǒng)

cout<<\"<==操作說(shuō)明: ******* ==>\"<cout<<\"<==A: 停車命令 ******* ==>\"<cout<<\"<==D: 出車命令 *** ==>\"<cout<<\"<==E: 退出程序 *** ==>\"<cout<<\"<==L: 顯示停車場(chǎng)內(nèi)狀況 \"<cout<<\"<==============================================>\"<}

void displayChange(STACK *S,ElemType pnum,int ptime){

printf(\" (單價(jià) %d元/小時(shí) )\\n\

printf(\"<=========================================>\\n\");

電子收據(jù)

printf(\"<==停車時(shí)間:--------------------------%d小時(shí)

==>\\n\

printf(\"<==車牌號(hào)碼:--------------------------%d ==>\\n\

printf(\"<==應(yīng)收費(fèi)用:--------------------------%d 元

==>\\n\

printf(\"<=================================>\\n\");

謝謝=歡迎下次再來(lái)

printf(\"正在打印收據(jù)請(qǐng)稍等\\n\");

for(int count=1; count < 1;count++){

printf(\"=\");

fflush(stdout);

sleep(1);

}

printf(\">\\n\");

sleep(1);

}

void wait(char *string){

printf(\"%s\\n\

for(int count=1; count < 1;count++){

printf(\"-\");

fflush(stdout);

sleep(1);

}

printf(\">\\n\");

}

int outparkstation(STACK *S1,STACK *TS,ElemType pnum){

int t_num=0;

int t_time=0;

while(1){

Pop(S1,&t_num,&t_time);

if(t_num == pnum){

tmpnum=t_num;

tmptime=t_time;

while(!Empty(TS)){

Pop(TS,&t_num,&t_time);

Push(S1,t_num,t_time);

}

return 1;

}

Push(TS,t_num,t_time);

}

return 0;

}

int inparkstation(STACK *S){

int parknum;

int parktime;

printf(\"還有車%d個(gè)位\\n\

printf(\"請(qǐng)輸入車牌號(hào)碼:\");

cin>>parknum;

while(chackinput(S,parknum)){

printf(\"車牌號(hào)碼重復(fù),請(qǐng)輸入%d1或者其他\

cin>>parknum;

}

printf(\"請(qǐng)輸入停車時(shí)間:\");

cin>>parktime;

printf(\"%d號(hào)車于%d時(shí)??吭?d位\\n\

Push(S,parknum,parktime);

return 1;

}

int inbiandao(SQUEUE *SQ,STACK *S){

int parknum ;

printf(\"對(duì)不起,停車場(chǎng)已滿,請(qǐng)您到便道等待.您將第\");

printf(\"%d進(jìn)入停車場(chǎng)\\n\

printf(\"請(qǐng)輸入車牌號(hào)碼:\");

cin>>parknum;

while(chackinput(S,parknum)) {

printf(\"車牌號(hào)碼重復(fù),請(qǐng)輸入%d1或者其他\

cin>>parknum;

}

EnQueue(SQ,parknum,0);

return 1;

}

int OutParkingStation(SQUEUE *biandao,STACK *car,STACK *tmp){

int parknum = 0;

int parktime = 0;

int buf=0;

if(!Empty(car)){

displaystats(car,10000);

printf(\"請(qǐng)輸入您要調(diào)出的車牌號(hào)碼:\");

cin>>parknum;

while(!chackinput(car,parknum)) {

printf(\"沒(méi)有您要的%d的車牌號(hào)碼,請(qǐng)輸入正確的車牌號(hào)碼:\

cin>>parknum;

}

outparkstation(car,tmp,parknum);

printf(\"%d時(shí)%d號(hào)車進(jìn)入停車場(chǎng)\\n\

printf(\"請(qǐng)輸入現(xiàn)在的時(shí)間:\");

cin>>parktime;

while(!chacktime(car,parktime)) {

cout<<\"輸入時(shí)間小于停車時(shí)間,請(qǐng)重新輸入:\";

cin>>parktime;

}

displayChange(car,parknum,parktime); if(biandao->front==biandao->rear) { }

else{ printf(\"%d號(hào)車位空開\\n\ printf(\"%d時(shí)便道上的%d號(hào)汽車駛

OutQueue(biandao,&parknum,&buf); Push(car,parknum,parktime); }

return 2;

入%d 號(hào)車 位

\

}

printf(\"停車場(chǎng)為空\(chéng)\n\");

return 1;

};

int main(int argc,char* agv[]){

char chance='A';

STACK car;

InitStack(&car);

STACK tmp;

InitStack(&tmp);

SQUEUE biandao;

InitQueue(&biandao);

loop:

while(1){

displayhead();

cout<<\"=>:\";

cin>>chance;

switch(chance) {

case 'A':

{

wait(\"正在查詢車位,請(qǐng)稍等:\");

if(Full(&car))

inparkstation(&car);

else

inbiandao(&biandao,&car);

break;

}

case 'D':

{

OutParkingStation(&biandao,&car,&tmp);

break;

}

case 'L':

{

displaystats(&car,10000);

break;

}

case 'M':

{

displaystats(&car,20000);

break;

}

case 'E':

{

wait(\"正在保存數(shù)據(jù)程序即將退出\\n命令執(zhí)行中:\");

exit(0);

}

default:

{

cout<<\"輸入錯(cuò)誤\"<goto loop;

}

}

}

system(\"PAUSE\");

return 0;

}

因篇幅問(wèn)題不能全部顯示,請(qǐng)點(diǎn)此查看更多更全內(nèi)容

Copyright ? 2019- 91gzw.com 版權(quán)所有 湘ICP備2023023988號(hào)-2

違法及侵權(quán)請(qǐng)聯(lián)系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市萬(wàn)商天勤律師事務(wù)所王興未律師提供法律服務(wù)