class Print{
private:
int maxsize;
int *pIDArray;
int front;
int rear; int nItems;
public:
Print(int s);
~Print();
void insert(int printJobID);
int remove();
int peekFront();
int isEmpty();
int isFull();
int size();}
Print::Print(int s)
{
maxSize=s;
pIDArray=new int[maxSize];
front=0;
rear=-1;
nItems=0;
}
bool Print::isEmpty()
{
return (nItems==0);
}
bool Print::isFull
{
return (rear==maxSize-1);
}
int Print::size()
{
return nItems;
}
void Print::insert(int printJobID)
{ if(isFull())
cout<<"The queue is full";
else
{
pIDArray[++rear]=printJobID;
nItems++;
}
}
int Print::remove()
{
if(isEmpty())
{
cout<<"Print Queue is empty";
return -999;
}
else{
nItems--;
return pIDArray[front++];
}
}
int Print::peekFront()
{
if(isEmpty())
{
cout<<"Queue is empty";
return -999;
}
else
return pIDArray[front];
}
int isFull();
int size();}
Print::Print(int s)
{
maxSize=s;
pIDArray=new int[maxSize];
front=0;
rear=-1;
nItems=0;
}
bool Print::isEmpty()
{
return (nItems==0);
}
bool Print::isFull
{
return (rear==maxSize-1);
}
int Print::size()
{
return nItems;
}
void Print::insert(int printJobID)
{ if(isFull())
cout<<"The queue is full";
else
{
pIDArray[++rear]=printJobID;
nItems++;
}
}
int Print::remove()
{
if(isEmpty())
{
cout<<"Print Queue is empty";
return -999;
}
else{
nItems--;
return pIDArray[front++];
}
}
int Print::peekFront()
{
if(isEmpty())
{
cout<<"Queue is empty";
return -999;
}
else
return pIDArray[front];
}
No comments:
Post a Comment
“What do you think about this?”
“Do you agree?
Share your thoughts in the comments below!”