I've a question regarding sorting of object in a vector
my object consists of x,y and civ. so I would like to know how do I sort the value of the civ in an descending order but at the same time retaining the value of x and y attached to it..
original
X: 4 Y: 5 CIV: 10
X: 3 Y: 2 CIV: 30
X: 3 Y: 3 CIV: 05
sorted
X: 3 Y: 2 CIV: 30
X: 4 Y: 5 CIV: 10
X: 3 Y: 3 CIV: 05
missionplan.cpp
for(int j=0; j < 5; j++)
{
for(int i = j; i < topfive.size(); i++)
{
if(topfive[i].getcivIndex() < topfive[i].getcivIndex)
{
topfive[i].swap(topfive[i]);
}
}
pointtwoD = topfive.at(i);//display all data starting from the first index
pointtwoD.displayPointdata();
}