# Include <time. h>
# Include <stdio. h>
# Define MAX 10
Struct tm * timer;
Struct carnode {
Char number [5];/* the license plate number is 6 Characters */
Struct tm * intime, * outtime;
};
Struct carstack {
Struct carnode car [MAX];
Int base;
Int top;
Int M;/* M records the number of data in the next station */
} Carstack;
Struct QNode {/* queue contacts */
Struct carnode data;
Struct QNode * next;
};
Struct LinkQueue {
Struct QNode * front, * rear;
} LinkQueue;
Void initstack (struct carstack * S)/* apply for space for the sequential stack */
{
S-> base = (int) malloc (MAX * sizeof (struct carnode ));
If (! S-> base)
{Printf ("Stack initialization failed n ");
Exit (-1 );
}
S-> top = S-> base;
S-> M = 0;
Printf ("Stack initialization completed n ");
Getchar ();
}
Void initqueue (struct LinkQueue * Q)/* queue of the leading node */
{Struct QNode * p;
P = (struct QNode *) malloc (sizeof (struct QNode ));
Q-> front = Q-> rear = p;
If (! Q-> front) {printf ("queue initialization failed n ");
Exit (-1 );
}
Q-> front-> next = Q-> rear-> next = NULL;
Printf ("queue initialization completed n ");
Getchar ();
}
Void push (struct carstack * S, struct carnode new)
{
If (S-> M = MAX) printf ("stack overflow!