sorting an array

Hey all,

So I'm trying to sort an array of 10 elements provided by the user. For Example:

Person 1: 5
Person 2: 3
Person 3: 9
etc etc...

I want it to also pair the value with the person. So it should read:
person 3: 9
Person 1: 5
Person 2: 3

Sort the values in descending order.

I can sort the array, but I cant get the Person number to pair with the value....

I apologize for the lack of code, it is at home and I am at work :/
The easiest way is to define a structure that contains the person's name (or number), and the value. Then have a single array of these structures. Sort the array based on the value of the person.
Got it, I will try that!! Thank you sir.
You're welcome.
It worked thanks!! Took a while though.
Topic archived. No new replies allowed.