Linked Queue Display function error cannot convert...

Posted 21 March 2013 - 06:42 PM

I'm trying to write a queue simulation program and I decided to use a linked list queue and templates. The queue is a line of customers which are going to be represented by integers. I'm getting this error from the display function in Queue.cpp file:
error cannot convert 'Customer' to 'NodeType<Customer>*' in assignment:
Here is the display function from queue.cpp

Re: Linked Queue Display function error cannot convert...

Posted 22 March 2013 - 03:18 PM

Okay so I fixed the problem and the program compiles and runs but whenever I try to print the items in the queue it only prints the last item added and nothing else. The length of the queue is right but it's not printing out all the elements. Here is the display function by itself, the entire Queue.cpp, and Driver.cpp:

Re: Linked Queue Display function error cannot convert...

Posted 22 March 2013 - 04:36 PM

When you add to the queue you should add to the rear. The first time rear is not changed from NULL so the first part of the if statement will always be run. If and when you do add to the end, the rear pointer will need to change.

Re: Linked Queue Display function error cannot convert...

Posted 22 March 2013 - 05:36 PM

Ok I figured that out I just put rear = newNode; after the if/else statment. Thanks for all the help on this. I'll probably have more questions later (relating more to how to code this assignment because I'm having a lot of trouble with it...it's really hard to come up with code when you've only had about 15-20 hours of sleep over the past 8 days (and btw it was not my fault that I only got that small amount of sleep...I couldn't sleep this week bc my body hates me and decided it wouldn't let me sleep as payback for changing sleeping medication), anyway, look for more topics posted by me throughout the weekend if you want to help out and get lots of reputation! Thanks again for all the help #define and Skydiver!