Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stl Vectors...

Status
Not open for further replies.

vivasuzi

Programmer
Jun 14, 2002
183
I've coded vectors before, but Now I forget how, and I have an assignment to do.

This is what I want to be able to do...
PartI:
1) I have a struct (mystruct) already created.
2) I want to put this into a vector
3) Everytime I add a struct, I want to make sure the struct with the lowest value is on top. I'll have a value1(mystruct.value1) that will be what I want to sort by.
4) After all elements have been added, I want to remove the struct that is on top (mystruct.value1 has the smallest value)
5) The struct with the 2nd smallest value should now be on top.

Part II (seperate part of the program)
I want a kind of FIFO queue for my structs. I know there's something in the stl but how do you use it? How do you insert, delete, and find out if it is empty?

I wrote it all out like this so I could make sure everyone knew exactly what I'm trying to do. I know there's a lot of questions, but please give me as much detail as possible. I'm going to do my program with array's for now, but I'm not sure if it will work properly that way. Thanx in advance! *Suzanne*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top