欢迎来到天天文库
浏览记录
ID:9395417
大小:44.50 KB
页数:15页
时间:2018-04-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*front;node
2、Q*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*Createstack(){Sta
3、ck*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;stack->count++;}void*pop(St
6、ack*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;while(stack->count==0){deletestack->
7、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(Que*queue){nodeQ*node;node=newnodeQ;if(node==NU
8、LL
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;dataptr=queue->front->dataptr;if(queue->count==1)queue->fro
11、nt=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;node=queue->front;queue->front=node->next;queue->count--;}delete
12、queue;}3.主文件ThePort.cpp#include"Car.h"#include#include#includetypedefstructInFor{stringnum;inthour;intmin;intsec;i
此文档下载收益归作者所有