#include<malloc.h>
#include<queue>
#include<iostream>
#define maxsize 100
using namespace std;
typedef struct Qnode
{
int data;
struct Qnode *next;
}Qnode;
typedef struct
{
Qnode *front;
Qnode *rear;
}LQnode;
void init(LQnode *&lqu)
{
lqu=(LQnode*)malloc(sizeof(LQnode));
lqu->front=lqu->rear=NULL;
}
void jin(LQnode *&rear,int x)
{
Qnode *s=(LQnode*)malloc(sizeof(LQnode));
s->data=x;
s->next=rear->next;
rear->next=s;
rear=s;
}
int chu(LQnode *&rear,int &x)
{
LQnode *s;
if(rear->next==rear)
return 0;
else
{
s=rear->next->next;
rear->next->next=s->next;
x=s->data;
if(s==rear)
rear=rear->next;
free(s);
return 1;
}
}
void display(LQnode *lue)
{
while(lue->front!=NULL)
{
cout<<lue->front->data;
lue->front=lue->front->next;
}
}
int main()
{
Qnode *stc;
LQnode *lue;
init(lue);
int a[5]={1,2,3,4,5};
for(int i=0;i<5;i++)
jin(lue,a[i]);
display(lue);
return 0;
}