Hey everyone,
I need to write a program that reads names and GPA’s from a text file. The file looks like:
James 3.9
Margaret 3.5
Charles 1.2
Jennifer 4.0
The program sorts the students ascending by gpa, and prints the sorted list including names. To keep the names with the numbers use parallel arrays, one for the names, the other for the numbers. Sort the numbers. Whenever you swap 2 numbers also swap their matching names in the names array.
The only thing that I've done so far is to open the text file and created a function called:
gpa_sorter(istream& in,string student[200],double studentGPA[200])
I don't know how to even write the pseudo code after while(!in.eof()) because im confused about sorting the data from in the file into 2 separate arrays, one that is double and one that is string.
Also, I'm not allowed to use vectors yet, and if you could please describe it to me as simple as possible in pseudo code, that would be great because i'm only in my first year.
Thanks again.