I have the vectors:
vector<string> countriesName;
vector<long> countriesPop;
These contain data such as
countriesName = {"UK","GER","IRE"};
countriesPop = {561655,6518,5168};
I am trying to work out how to sort the countries population from smallest to largest while keeping the index's between the two vectors the same.
I have seen other solutions which require to use a struct and a vector of the structs. However as I have other functions which already rely on the original vectors I would preferably find a solution using these so I dont have to rework a lot of other functions.
Therefore the output after sorting should go from
UK 561655
GER 6518
IRE 5168
To
IRE 5168
GER 6518
UK 561655