11-07-2004, 02:06 PM | #1 (permalink) |
"Afternoon everybody." "NORM!"
Location: Poland, Ohio // Clarion University of PA.
|
[C++] Queue Testing Help
I need some help with a "Quasi" Queue program we're doing in our Data Structures class.
Being that our teacher is a moran and can't figure out we have no idea what's going on, I'm basically lost. What he basically wants us to do is a write, along with our class implimentation and specification files (this is actually the easy part) he wants us to write another header file where we place a struct, it's members being whatever the hell we want, like social security numbers, names, whatever; and an overloaded operator (in this case <<) to compare the stack to a specific condition. We delcare what's in the stack members in the main program, and send them to the Queue from there. The Class we're using is Templated, if that matters. Example (I'm guessing): In the main program, a bunch of random numbers are generated (these numbers being members of a stack, in that seperate header file,) each is Enqueued onto the Stack, in a Linked-List. Then we do a 'Pull' function, which searches the Stack, node by node, to see if there is a number that meets the special condition, let's say the number '5.' If nothing is retrieved from the Pull function, that means one of the numbers in the linked-list wasn't a 5, but if there is a five, it stops it's search, then gives the number back to the main program, to say it found it. What I'm basically lost with is the overloaded operator part, and how it actually compares a member of the stack to what's in the Queue. And how to actually send numbers, or any other kind of data to be put into the Queue, unless I'm already doing this right, and just need to figure out overloaded operators. Also, we're suppose to print out the number we "Pulled" using the Overloaded Operator. If anyone actually understands this and can help, would be much appreciated...
__________________
"Marino could do it." Last edited by Paradise Lost; 11-07-2004 at 02:09 PM.. |
11-08-2004, 11:24 AM | #2 (permalink) |
Too hot in the hot tub!
|
so, what does it return? a bool or a <T>?
The pull function I would assume would return a <T>, but what are you supposed to return if the search parameter is not found. An overloaded operator (== in this case), would logically return a bool. Sounds ike you are trying to implement two different functions to me.
__________________
But I don't want ANY Spam! |
Tags |
queue, testing |
|
|