#include
#include
#define MAX 10
struct tm *timer;
struct carnode{
char number[5]; /* 车牌号为6位*/
struct tm *intime,*outtime;
};
struct carstack{
struct carnode car[MAX];
int base;
int top;
int M; /* M 记录下站内的数据个数 */
}carstack;
struct QNode{ /* 队列接点 */
struct carnode data;
struct QNode *next;
};
struct LinkQueue{
struct QNode *front,*rear;
} LinkQueue;
void initstack (struct carstack *S) /* 为顺序堆栈申请空间 */
{
S->base=(int)malloc (MAX*sizeof(struct carnode));
if (!S->base)
{ printf(" 栈的初始化失败n");
exit(-1);
}
S->top=S->base;
S->M=0;
printf(" 栈初始化完成 n");
getchar();
}
void initqueue(struct LinkQueue *Q) /* 带头结点的队列 */
{ struct QNode *p;
p=(struct QNode *)malloc(sizeof(struct QNode));
Q->front=Q->rear=p;
if(!Q->front) { printf(" 队列的初始化失败n");
exit(-1);
}
Q->front->next=Q->rear->next=NULL;
printf(" 队列初始化完成 n");
getchar();
}
void push(struct carstack *S,struct carnode new)
{
if (S->M==MAX) printf("栈上溢出!