#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <windows.h>
#include <string.h>
using namespace std;
const MAXSIZE = 20;
typedef int elemType;
class Queue
{
public:
Queue();
~Queue();
bool push(elemType data);
bool pop();
private:
elemType front,rear;
elemType queue[MAXSIZE];
};
Queue::Queue()
{
front = rear = 0;
}
Queue::~Queue()
{
queue[MAXSIZE] = NULL;
}
bool Queue::push(elemType data)
{
if(size == MAXSIZE - 1)
{
cout<<"队列满";
return false;
}
size++;
queue[rear] = data;
rear = (rear+1)%MAXSIZE;
return true;
}
bool Queue::pop()
{
if(size == 0)
{
cout<<"队列已空";
return false;
}
size--;
arr[++poporder] = queue[front];
front = (front+1) % MAXSIZE;
return true;
}