#include<iostream>
using namespace std;
typedef int ElemType;
typedef struct QueueNode node;
typedef struct QueueNode *link;
struct QueueNode{
ElemType data;
struct QueueNode *next;
};
link front=NULL;
link rear=NULL;
void display(){
link point;
point=front;
while(point!=NULL){
cout<<point->data<<" ";
point=point->next;
}
cout<<endl;
}
ElemType delQueue(){
link top;
ElemType temp;
if(front==NULL){
rear=NULL;
return -1;
}else{
top=front;
front=front->next;
temp=top->data;
free(top);
return temp;
}
}
void addQueue(ElemType value){
link new_node;
new_node=(link)malloc(sizeof(node));
new_node->data=value;
new_node->next=NULL;
if(front==NULL)
front=new_node;
else
rear->next=new_node;
rear=new_node;
}