Sorting lists

deleted
Last edited on
Add to the Stock struct one more field that represents the precedence somehow. The easiest would be to assign it a row number and then simply sort by this key. But that, in my opinion still doesn't do it.

In my opinion, what you need is a dictionary collection, a. k. a. a map in STL. You would have a map of strings and prices that you would fill with the contents of the file. If any given entry being read from the file already exists in the map, the entry in the map is overwritten with the entry being read.

In the end, the map will contain all symbols, but only the most recent prices per symbol. No sort needed.
Topic archived. No new replies allowed.