欢迎来到天天文库
浏览记录
ID:14739618
大小:89.00 KB
页数:15页
时间:2018-07-30
《停车场管理系统设计源代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、附录源代码1.头文件Car.h#ifndefCAR#defineCAR#includeusingnamespacestd;typedefstructNode{void*data;structNode*link;}nodeS;typedefstructSta{nodeS*top;intcount;}Stack;typedefstructNodeQ{void*dataptr;structNodeQ*next;}nodeQ;typedefstructQueues{intcount;nodeQ*f
2、ront;nodeQ*rear;}Que;Stack*Createstack();void*pop(Stack*stack);voidpush(Stack*stack,void*data);voidDestroyStack(Stack*stack);Que*CreateQueue();voidEnqueue(Que*queue);void*Dequeue(Que*queue);voidDestroyqueue(Que*queue);#endif1.实现文件Car.cpp#include"Car.h"Stack
3、*Createstack(){Stack*stack;stack=newStack;if(stack==NULL)returnNULL;stack->count=0;stack->top=NULL;returnstack;}voidpush(Stack*stack,void*data){nodeS*node;node=newnodeS;if(node==NULL
4、
5、stack==NULL)return;node->data=data;node->link=stack->top;stack->top=node;
6、stack->count++;}void*pop(Stack*stack){void*data;nodeS*node;node=newnodeS;if(stack->count==0)returnNULL;data=stack->top->data;node=stack->top;stack->top=node->link;stack->count--;returndata;}voidDestroyStack(Stack*stack){nodeS*node;if(stack->count==0)return;
7、while(stack->count==0){deletestack->top->data;node=stack->top;stack->top=node->link;stack->count--;}deletestack;}Que*CreateQueue(){Que*queue;queue=newQue;if(queue==NULL)returnNULL;queue->count=0;queue->front=NULL;queue->rear=NULL;returnqueue;}voidEnqueue(Qu
8、e*queue){nodeQ*node;node=newnodeQ;if(node==NULL
9、
10、queue==NULL)return;node->next=NULL;if(queue->count==0){queue->front=node;}else{queue->rear->next=node;}queue->rear=node;queue->count++;}void*Dequeue(Que*queue){void*dataptr;if(queue->count==0)returnNULL;datap
11、tr=queue->front->dataptr;if(queue->count==1)queue->front=queue->rear=NULL;elsequeue->front=queue->front->next;queue->count--;returndataptr;}voidDestroyqueue(Que*queue){nodeQ*node;if(queue->count==0)return;while(queue->count==0){deletequeue->front->dataptr;n
12、ode=queue->front;queue->front=node->next;queue->count--;}deletequeue;}3.主文件ThePort.cpp#include"Car.h"#include#include#includetypedefstructInFor{stringnum;inthour;intmin;intsec;i
此文档下载收益归作者所有