Hello, I have a couple of questions i'd like to ask regarding a recent assignment ive been given to do. I have to write a program that reads in a list of names & numbers in the format:
Bill Smith 3456
Jill Sixpack 7654578
Fred Flintstone 835647
Donald Duck 298465475
Micky Mouse 0874567878
Minnie Mouse 0874567878
Albert Einstein 9032831
and print them in the format(Alphabetical surname order, followed by forename then number):
Duck, Donald 298465475
Einstein, Albert 9032831
Flintstone, Fred 835647
Mouse, Micky 0874567878
Mouse, Minnie 0874567878
Sixpack, Jill 7654578
Smith, Bill 3456
It is required that we use our own selection sort method to sort the surnames in alphabetical order but what im wondering, is how will I be able to sort them whilst keeping the forename & number associated with the specific surname. For instance, if i read both the surnames & forenames at once and stored them in one array, and used my sort method to sort that alphabetically, it'd sort the forenames aswell. Whereas I only want the surnames to be sorted. Will I need more than one array? Can anyone give me a bit of guidance as to how to approach this? Many thanks