#include
# define maxnum 100
using namespace std;
Typedef struct {
The int data [maxnum];
Int the front;
Int rear;
} sqQueue;
/*
Team empty status: qu. Rear==qu. The front;
Team full state: (qu. The rear + 1) % maxnum==qu. The front;
Into the team operation: qu. Rear=(qu. The rear + 1) % maxnum; Qu. Data [qu. Rear]=x;
The team operation: qu. Front=(qu. The front + 1) % maxnum; X=qu. Data [qu. Front];
*/
//initialize
Void initQueue (sqQueue& Qu)
{
Qu. The front=qu. The rear;
}
//determine team empty
Int isQueueEmpty (sqQueue qu)
{
If (qu. Front==qu. Rear)
{
Cout & lt; <"Team" empty & lt;
}
The else
{
Cout & lt; <"Team is not empty" & lt;
}
}
//into the team
Int the enQueue (sqQueue& Qu, int x)
{
If ((qu. The rear + 1) % maxnum==qu. The front)
{
Cout<& lt;" Team full to team "& lt;
}
Qu. Rear=(qu. The rear + 1) % maxnum;
Qu. Data [qu. Rear]=x;
return 1;
}
//the team
Int to deQueue (sqQueue& Qu, int& X)
{
If (qu. Rear==qu. Front) {
Cout & lt; <"Teams empty and not a" & lt;
}
Qu. Front=(qu. The front + 1) % maxnum;
X=qu. Data [qu. Front];
return 1;
}
Int main ()
{
int x;
SqQueue q;
InitQueue (q);
IsQueueEmpty (q);
The enQueue (q), 1);
The enQueue (q), 2);
IsQueueEmpty (q);
DeQueue (q), x);
Cout & lt;
Cout & lt;
return 0;
}