Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

But I need help on this:

image text in transcribed

My code so far:

image text in transcribed

And what I need sorted by using pointers:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions