# Include "stdio. h"
# Include "string. h"
# Include "stdlib. h"
# Include "time. h"
# Define null 0
# Define Maxsize 4
Void clear (char a [])
{
Int I, counta;
Counta = strlen ();
For (I = 0; I <counta; I ++)
A [I] = '';
}
Struct car // define the car's struct
{
Char message [10];
Char num [10];
Char intime [10];
Char outtime [10];
Int expense;
Int delay;
Int position;
};
Typedef struct //************************************ *********************************
{
Struct car d [Maxsize];
Int top;
} SeqStack;
Void init (SeqStack * s) // initialize the stack
{
S-> top =-1;
}
Int isemptystack (SeqStack * s) // checks whether the stack is empty.
{
If (s-> top =-1)
Return 1;
Else
Return 0;
}
Int isfullstack (SeqStack * s) // determines whether the stack is full.
{
If (s-> top = Maxsize-1)
Return 1;
Else
Return 0;
}
Void push (SeqStack * s, struct car x) // stack entry
{
If (! Isfullstack (s ))
{
S-> top ++;
S-> d [s-> top] = x;
}
}
Struct car pop (SeqStack * s) //, take the top element of the stack and exit the stack
{
Car x;
If (s-> top! =-1)
{
X = s-> d [s-> top];
S-> top --;
Return x;
}
}
Car gettop (SeqStack * s) // gets the top element of the stack.
{
Car x;
If (s-> top! =-1)
{
X = s-> d [s-> top];
Return x;
}
}
//************************************** **************************** *********
//************************************** * *** Queue linked list *********************************** ***
Typedef struct slnode // defines the contact nature of the chain queue
{
Struct car data