Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with my code. My program is reading from a csv file and sort them in ascending order by lastname and SSN using

I need help with my code. My program is reading from a csv file and sort them in ascending order by lastname and SSN using an array of pointers and print. I need help on sorting it properly by using array of pointers without changing the original studArray. My code so far:

image text in transcribed

What the csv file looks like and what I need to sort

image text in transcribed

71 1 global number of students const int NUM STUDENTS - 20; int main() void sortByLastname (Student *indexBy Lastname[], int size) for (int i = 0; i ("indexByLastname) [i + 1].lastName), //opening csv file ifstream readFile; readFile.open("students.csv"); if(!readFile) Student *temp - indexBy Lastnamei + 1]; indexByLastnamei + 1] = indexBy Lastname[i]; indexByLastname[i] = temp; 1,Alfalfa, Aloysius, 123-45-6789,40,90, 100,83,49,D- 2,Alfred, University, 123-12-1234,41,97,96,97,48,D+ 3, Gerty,Gramma, 567-89-0123,41,80,60,40,44, 4, Android, Electric, 087-65-4321,42,23,36,45,47,B- 5, Bumpkin, Fred, 456-78-9812,43,78,88,77,45,- 6, Rubble, Betty, 234-56-7890,44,90,80,90,46,C- 7, Noshow, Cecil, 345-67-8901,45,11,-1,4,43,F 8,Buff,Bif,632-79-9939,46,20,30,40,50,B+ 9, Airpump, Andrew, 223-45-6789,49,1,90,100,83,A 10, Backus, Jim, 143-12-1234,48,1,97,96,97,A+ 11, Carnivore, Art, 565-89-0123,44,1,80,60,40,D+ 12, Dandy, Jim, 087-75-4321,47,1,23,36,45,C+ 13, Elephant, Ima, 456-71-9012,45,1,78,88,77,B- 14,Franklin, Benny,234-56-2890,50,1,90,80,90,- 15, George, Boy, 345-67-3901,40,1,11,-1,4,B 16, Heffalump, Harvey, 632-79-9439,30,1,20,30,40, 17, de Paul, Martin, 829-34-3412,34,49,12,90,34,B+ 18, Madrigal, Jay, 309-12-4312,18,2,34,34,5,F 19, Osborne, Demi, 025-24-7821,50,98,100,89,99,A 20. Garrett, Keith, 723-35-9082,23,53, 10,34,84,C+ 1. Print data in ascending order by last name 2. Print data in ascending order by SSN 3. Search by last name 4. Search by SSN 5. Exit Select a Menu

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

Step: 3

blur-text-image

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

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions

Question

1. How might volunteering help the employer and the employee?

Answered: 1 week ago