# Include
# Include
# Include
# Define N 30/* 27 <=n <= 127 */
# Define NULL 0
Typedef struct Qnode/* define the Contact Type of the queue */
{
Int data;
Struct Qnode * next;
} Qnode, * Queueptr;
Queueptr p, q;
Typedef struct
{
Queueptr front;
Queueptr rear;
} LinkQueue;
LinkQueue * Q;/* define a queue */
Typedef struct stack4/* defines the minute stack */
{
Queueptr top;
Queueptr base;
} Stack4;
Stack4 * min;
Typedef struct stack11/* defines the 5-minute stack type (hourly stack type )*/
{
Queueptr top;
Queueptr base;
} Stack11;
Stack11 * fmin, * hour;/* build a five-minute and hourly stack */
Int minute;
Void initQueue (linkQueue * O)/* queue initialization */
{
Int I = 1, j;
Queueptr head, new;
Head = (Qnode *) malloc (sizeof (Qnode ));
If (! Head)
{
Printf ("failture for applying a area! N ");
Exit (0 );
}
O-> front = p = head;
Head-> data = I;
Head-> next = NULL;
While (I {
New = (Qnode *) malloc (sizeof (Qnode ));
If (! New)
{
Printf ("failture for applying a area! N ");
Exit (0 );
}
Head-> next = new;
Head = head-> next;
Head-> data = ++ I;
}
Head-> next = NULL;
O-> rear = head;
}