counting elements in a queue

Never mind :P
Last edited on
Can you tell me what I am doing wrong?

Simple, you're not keeping track of the queue's length in a member variable.
Duplicating a queue just to count its elements is quite absurd.

Edit: also, what on earth is this?
queue.deleteQueue(tmpQueue);

Why would you tell some queue to delete a different queue?
Last edited on
What does this statement

queue.deleteQueue(tmpQueue);

do? I think the problem is in this statement.

If do not take into account the statement above the code is valid if the return type of isEmptyQueue() is bool and it returns false in case the queue is not empty.
In any case it would be better to rewrite the condition the following way

while ( !queue.isEmptyQueue() )
Last edited on
Thanks so much for the help! It was that statement. Once I took out that tmpQueue it worked :)
Topic archived. No new replies allowed.