We don't have the definition of your queue class so can't really tell if some of those are right or wrong.
2. Probably wrong. You are not supposed to delete the item from the queue. Just retrieve it. There is probably another way to get the item out of the queue without deleting it.
3. Definitely wrong. Just think a minute about what you have done with those loops. You first initialize variable i to be q.front() and then test to see if i is less and q.front() ??? Most likely should be this? for(int i = q.front(); i < q.back(); i++) What I don't know if what kind of data is in the queue. Is it a queue of strings (most likely answer considering the question), a queue of ints or what??
4. Similar answer as given for #2, above.
5 & 6. I have no idea since I don't know the definition of the queue class.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Online 21,960 posts
since Aug 2005