【www.gdgbn.com--php应用】

#include
#include
#include
#define N 30                                                            /*27<=N<=127*/
#define NULL 0
typedef struct Qnode                                              /*定义队列的接点类型*/
{
int data;
struct Qnode *next;
}Qnode,*Queueptr;
Queueptr p,q;
typedef struct
{
Queueptr front;
Queueptr rear;
}linkQueue;
linkQueue *Q;                                                    /*定义队列*/
typedef struct stack4                                                       /*定义分钟栈*/
{
Queueptr top;
Queueptr base;
}stack4;
stack4 *min;
typedef struct stack11                                                         /*定义5分钟栈类型(小时栈类型)*/                                              
{
Queueptr top;
Queueptr base;
}stack11;
stack11 *fmin,*hour;                                                 /*建立五分钟和小时栈*/
int minute;
void initQueue(linkQueue *O)                                /*队列的初始化*/
{
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;
}

本文来源:http://www.gdgbn.com/jiaocheng/13144/