Sorting in Multidimensional Arrays

I have a program in which there is a two-dimensional array. Let's say it is array[10][2].
In array[0][0] to array[9][0], I store the Names of different students.Then in array[0][1] to array[9][1] I store the marks of respective students.

Now I want to arrange the whole array as an Excel Table sort of thing, w.r.t. the numbers of students... The problem is, even if I can apply bubble sorting on the marks column, the students column doesn't change with respect to the marks.

For Example:

Student - - - - - - Marks

Marc - - - - - - - - 67
Bia - - - - - - - - - 90
Amanda - - - - - -86
Will - - - - - - - - -91
Vic - - - - - - - - - -80


will be arranged like

Student - - - - - Marks

Marc - - - - - - - -91
Bia - - - - - - - - -90
Amanda - - - - - 86
Will - - - - - - - - 80
Vic - - - - - - - - -67


whereas I want it arranged like this:

Student - - - - - -Marks

Will - - - - - - - - -91
Bia - - - - - - - - - 90
Amanda - - - - - -86
Vic - - - - - - - - - 80
Mark- - - - - - - - 67


Is there any solution?
Last edited on
for each switch performed in marks column do one in students column
or
create a struct that holds name and mark and sort one-dimensional array.
Thanks a lot!
Topic archived. No new replies allowed.