#include "iostream.h"
class Queue
{
private:
int *Arr;
int Size;
int ptr;
public:
Queue()
{
int i;
Size=1000;
Arr=new int[Size];
for (i=0; i < Size; i++) Arr[i]=0;
ptr=0;
}
Queue(int Sz)
{
int i;
if (Sz <= 0) Sz=1000;
Size=Sz;
Arr=new int[Size];
for (i=0; i < Size; i++) Arr[i]=0;
ptr=0;
}
~Queue()
{
delete [] Arr;
}
int isEmpty()
{
if (ptr == 0)
return -1;
else
return 0;
}
void Enque(int x)
{
if (ptr < Size)
{
Arr[ptr++]=x;
}
}
int Deque()
{
int z,i;
if (ptr > 0)
{
z=Arr[0];
for (i=1; i <= (ptr-1); i++) Arr[i-1]=Arr[i];
ptr--;
return z;
}
return -1;
}
void Show()
{
for (int i=0; i < ptr; i++)
cout << Arr[i] << endl;
}
};
int main(int argc, char* argv[])
{
Queue Q;
int n;
while (1)
{
cout << "Enter number (0-end): ";
cin >> n;
if (n == 0) break;
Q.Enque(n);
}
cout << endl << "Que:" << endl << endl;
Q.Show();
return 0;
}