C++: Sorting the Contents of an Array Based on the Contents of Another
I often find while programming that I want to sort the contents of one array based on that of another. For instance, say I had the arrays
int rankings[] = {1,4,2,5,3}
string names[] = {"George", "Fred", "Gary", "John", "Bob"}
and I wanted to resort both arrays based on ranking. That is, I would want the following result:
int rankings[] [...]