0

Thanks to those guys who helped me out yesterday. I have one more problem; my print function for the queue program doesnt work and goes into an endless loop. Also I am unable to calculate the length of my queue. I started getting compilation errors when I included a length

function.

```
template<class ItemType>
void Queue<ItemType>::MakeEmpty()
{
rear = maxQue - 1;
front = maxQue - 1;
}
template<class ItemType>
bool Queue<ItemType>::IsEmpty()
{
return (rear==front);
}
template<class ItemType>
bool Queue<ItemType>::IsFull()
{
return ((rear+1) % maxQue == front);
}
template<class ItemType>
int Queue<ItemType>::length()
{
return 0; // I dont know what to put here
}
template<class ItemType>
void Queue<ItemType>::Print()
{
int current;
current = rear;
do{
current = (current + 1) % maxQue;
std::cout << items[current] << std::endl;
}while(current != front);
}
// Main function items
IntQueue.Enqueue(1);
IntQueue.Enqueue(2);
IntQueue.Enqueue(3);
IntQueue.Enqueue(4);
cout << "int length 3 = " << IntQueue.length() << endl;
IntQueue.Dequeue(x);
cout << "int length 4 = " << IntQueue.length() << endl;
IntQueue.Print();
```

my length function has no code and I dont know what to put in there.