sorting
How would you sort more than two corresponding arrays at once? I have the following code, which works just fine, but everytime I try to add another array to sort with it, it never seems to work. Example: I want to sort dog names by their weight. The dog names are stores in an array called names[ ], and the weights are stored in weights[ ]. Element 0 in names[ ] corresponds with element 0 in weights[ ], and so on. But, there's another array called furs[ ] that stores the colors of each dog's fur, and corresponds with the other two, and it needs to change along with weights[ ] and names[ ] also. How can I fit that in?
for(int e=0; e<72-1; e++)
{
for(int g=0; g<72; g++)
{
if(weights[g]>weights[g+1])
{
double Temp = weights[g];
weights[g] = weights[g+1];
weights[g+1] = Temp;
String Temp2 = names[g];
names[g] = names[g+1];
names[g+1] = Temp2;
}
}
}

