vector<int> reference = ages;
sort(ages.begin(),ages.end());
for (int i=0; i<20 ;++i){
for (int j=0; j<20; ++j){
if (ages[i]==reference[j]){
cout << setw(LongestString(names))<<names[j] <<setw(agewidth)<<ages[i]<<setw(probwidth)<<prob[j]<<endl;
}
}
}
So I have a three vectors and I want to sort them based off of the ages, and then reorder them. However, there are repetitions in the ages, so whenever it gets to those it prints them multiple times. Is there a way to prevent that without the creation of a structure?
Aucun commentaire:
Enregistrer un commentaire