I cant figure out why my program is saying that the front of my queue is something that it shouldn't be. Without posting the whole long code, what could possibly be wrong with this. (I'm not using #include <queue>, just class queue_type)
Input
a.clear_queue();
cout << "\nEnter a license number ==> ";
cin >> x;
Putting it in a.queue
if (!(a.full_queue()))
{
a.insert_queue(x);
cout << "Vehicle has been parked in Garage 1." << endl;
cout << "============================================================================" << endl << endl;
break;
}
Am I getting messed up because I need to make my queues 1 size larger to account for front being dead space? It keeps telling me that my front == whatever number i set my int maxqueue to.
Again, we can't know without the code. It's like saying "Doctor! Doctor! My friend is sick! What's wrong with him?" "Can I see your friend?" "No, he's too boring."
Yeah You're right. I'm starting to get a feeling that it has to do with the voids at the bottom but I'm not sure. I honestly would love some direction with this front and rear issue.
In the future, use [code][/code] tags and not quote tags.
Anyway, I'm struggling to understand your code and your queue class...it doesn't look like a queue at all, but I'm not sure what it is. Also, your naming conventions require a lot of extra typing...you don't need "_queue" as the end of your member functions for any reason. Also, what is the purpose of front and rear? I am struggling to understand what you are trying to do here :(
If I remove the "_queue" I get errors such as "class queue_type has no member 'full'". I'm using a format (which we were taught) which isn't the STL for queues and I think it's messing things up. I really don't understand why we're supposed to do work this way with queues and not use the STL pop & push method.
If this is what you're being taught to do, then sorry I can't help you. Maybe someone else who knows the proper way things should be can help you, but I don't want to get you bad grades or similar by doing something you're not supposed to. If I could understand your code maybe I could spot the problem(s), but I'm having a hard time diagnosing the way this all works.
Thanks for taking a look at it. I'm going to quickly redo this using the standard template and see how it works. I'm sure it will be ten times easier to read and figure out where the problems are. I'm not concerned with the grade; the prof gives us 2 sheets of example queues using the format I used and then gives us projects to do using them as a base, which usually gives huge amounts of problems. I'll post back soon with the new code.. well.. if I run into an issue that is *crosses fingers*
Edit: Can you define a queues size, as these must be able to hold only 5 elements... or do I need to use deque?
Thank you for that. I literally was given two sheets of paper with a sample code of how to input and that was it so I'm trying to play catch up. Is there also a pointer for the back element, or do I just need to adjust my sizes according to the one blank space for the front pointer?