There was another thread about this (http://www.daniweb.com/forums/thread114737.html) but it didn't seem to be resolved?
If I have a vector of int's and another vector of the same length of corresponding names, I would like to sort the ints and have the names "follow"
vector<string> Doubles;
Doubles.push_back("Name1");
Doubles.push_back("Name2");
Doubles.push_back("Name3");
vector<int> Ints;
Ints.push_back(4);
Ints.push_back(1);
Ints.push_back(7);
sort(Ints.begin(), Ints.end());
for(int i = 0; i < Ints.size(); i++)
{
cout << Ints[i] << endl;
}
Now I would like the names to be sorted in the same order, ie. Name2, Name1, Name3.
There is a 3rd parameter of the sort() function, but I don't understand how to use it. Can someone shed some light?
Thanks,
Dave