Aug 24, 2012 at 6:01pm UTC
Never mind :P
Last edited on Aug 24, 2012 at 6:15pm UTC
Aug 24, 2012 at 6:05pm UTC
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 Aug 24, 2012 at 6:14pm UTC
Aug 24, 2012 at 6:14pm UTC
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 Aug 24, 2012 at 6:14pm UTC
Aug 24, 2012 at 6:20pm UTC
Thanks so much for the help! It was that statement. Once I took out that tmpQueue it worked :)