#include<stdio.h>
#include<stdlib.h>
#define Maxsize 100
typedef struct{
int data[Maxsize];
int front,rare;
}sequeue;
void SetNULL(sequeue *sq)
{
sq->front=sq->rare=-1;
} //置空
int Empty(sequeue *sq)
{
if(sq->front==sq->rare) return 1;
else return 0;
} //判断是否为空
sequeue *ENSequeue(sequeue *sq,int x)
{
if(sq->front==(sq->rare)%Maxsize+1)
{
printf("满了\n");
return NULL;
}
else
{
sq->rare++;
sq->data[sq->rare]=x;
}
} //入队
int DESequeue(sequeue *sq)
{
if(Empty(sq))
{
printf("空\n");
return -1;
}
else
{
sq->front++;
return sq->data[sq->front];
}
} //出队
int main()
{
sequeue *s;
s=(sequeue*)malloc(sizeof(sequeue));
SetNULL(s);
int i,n,x;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&x);
ENSequeue(s,x);
}
while(!Empty(s))
{
printf("%d ",DESequeue(s));
}
return 0;
}
//main函数里只单纯运行了简单的入队与出队