OK, as I understand the problem you have a list od students and associated with each student is a set of grades.
You want to sort the list of students alphbetically and ensure that the grades stay with the right students.
One way to do this is to hold the data in a structure
1 2 3 4 5
|
struct studentData
{
char name[10];
inr grades[3];
}
| |
then create an array of the structures
You can read more on strucs on
http://www.cplusplus.com/doc/tutorial/structures.html
This removes the complication of trying to keep multiple arrays in synch.
I would also advise the use of suitable functions to break you code into small managable chunks. A good example from your current problem would be a 'Swap' function that takes swaps two entries.
It makes the code easier to read, and also makes testign and debugging simpler - you can create a temporary piece of code that creates two entries, printes them, swaps and prints again, for example. Once this works, you know the swap function works and can just use it in future.
Hope this helps.