Sort array and preserve index
in
Programming Questions
•
2 years ago
Hi guys,
for a scoring system in a game, a player can score on 12 different subjects. For each of these subjects, a score is kept (normally in the range of -5,5). What I want from an array is the index of the two highest and lowest scoring subjects.
scorep1[0] - scorep1[11] can have the same score. I've tried doing it via the max() command, or the sort() command, but when there are two identical entries, it messes it's up.
I'm not necessarily interested in the score, I just want the indices (the subjects) to display what subject is best and what is worst for a student.
Any help on this?
1