Question: Please help! My program is trying to sort a csv file by lastname and SSN by using pointers. So I am trying to make an
Please help! My program is trying to sort a csv file by lastname and SSN by using pointers.
So I am trying to make an array of pointers but that is unsorted indexing and sorted indexing like this:

But I need help on this:

My code so far:

And what I need sorted by using pointers:

Unsorted Indexing Student* indexByLastName [5] Student stuArray[5] 1111 Test3 100 9 6 Test Testa 10083 x Last Name First Name SSN Testi Test2 Alfalfa Aloysius 123-45-6789 40 90 Alfred University 123-12-1234 41 97 erty Gramma 567-89-0123 41 80 Android Electric 087-65-4321 4223 Bumpkin Fred 456-78-90124378 Student* indexBySsn[5] V 3645 Sorted Indexing Student* indexByLastName [5] Student stuArray[5] 1111 Test2 Test3 90 100 9 7 96 Testa Final Grade 8349 97 48D+ Last Name First Name SSN Testi Alfalfa Aloysius 123-45-6789 40 Alfred University 123-12-1234 41 Gerty Gramma 567-89-0123 41 Android Electric 087-65-4321 42 Bumpkin Fred 456-78-9012 43 604044 Student* indexBySsn[5] 4547 78 877 45 CELTA // Assign each pointer of array of pointers indexBySSN to each element of gradesArray (index by index) 1/ Assign each pointer of array of pointers indexByLastname to each element of gradesArray (index by index) // call sortBySSSN function passing indexBySSN as an argument // call sortByLastname function passing indexBy Lastname as an argument 14 15 16 17 // global number of students const int NUM_STUDENTS = 20; int main() V Student studArray[NUM STUDENTS]; // array of pointers Student* indexBySSN[NUM STUDENTS]; Student* indexByLastname [NUM STUDENTS]; //opening csv file ifstream readFile; readFile.open("students.csv"); if(!readFile) cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
