D
Daz
Hi everyone.
I am trying to make a program which handles about 70 different objects,
of the same type. The properties are as follows:
std::string ItemName
int ItemType
int Calories
int Weight
int Density
I am looking for a way of sorting the list during the several stages of
their handling.processing, but I don't have a clue where to start. The
list will need to be sorted 3 times, once by Calories, once by Weight,
and then again by Density.
Obviously, I can put each property into a vector, and then sort them,
but this doesn't sort the others into their respective positions (they
need to be handled as rows of data). I am sure that I am either not
realizing the full potential of a vector, or I need to use/create
something else, such as a custom class based on a vector, but I am
really not sure.
I would appreciate any suggestions.
Thanks in advance.
Daz
I am trying to make a program which handles about 70 different objects,
of the same type. The properties are as follows:
std::string ItemName
int ItemType
int Calories
int Weight
int Density
I am looking for a way of sorting the list during the several stages of
their handling.processing, but I don't have a clue where to start. The
list will need to be sorted 3 times, once by Calories, once by Weight,
and then again by Density.
Obviously, I can put each property into a vector, and then sort them,
but this doesn't sort the others into their respective positions (they
need to be handled as rows of data). I am sure that I am either not
realizing the full potential of a vector, or I need to use/create
something else, such as a custom class based on a vector, but I am
really not sure.
I would appreciate any suggestions.
Thanks in advance.
Daz