Question: I am having trouble with outputting my users input. My program is a binary search from a csv file and sorted by using pointers. This

I am having trouble with outputting my users input. My program is a binary search from a csv file and sorted by using pointers. This is my function for sorting the last name and output

I am having trouble with outputting my users input. My program is

a binary search from a csv file and sorted by using pointers.

Now I need to do a binary search/ searching the last name and output all the data from that name. This is my binary function but it doesn't output anything.

This is my function for sorting the last name and output Now

Please help! Thank you.

void sortByLastname (Student studArray[], Student* indexByLastname[]), //loop runs from 0 to maximum number of students in the file for(int i = 0; i curr) minIndex = j; //here we swap ith position with the minimum index variable Student s = studArray[minIndex]; studArray[minIndex] = studArray[i]; studArray[i] = 5; //we assign it to the ith position of indexByLastname variable indexBy Lastname[i] = {studArray[i]; 73 } 11 Sorted by Last Name ID Last Name First Name SSN Grade 9 AirpumpAndrew 223-45-6789 A 1 Alfalfa Aloysius 123-45-6789 D- 2 Alfred University 123-12-1234 D+ 4 Android Electric 087-65-4321 B- 10 Backus Jim 143-12-1234 A+ 8 Buff Bif 632-79-9939 B+ 5 Bumpkin Fred 456-78-9012 A- Carnivore Art 565-89-0123 D+ 12 Dandy Jim 087-75-4321 C+ 13 Elephant 456-71-9012 B- 14 Franklin Benny 234-56-2890 B- 20 Garrett Keith 723-35-9082 C+ 15 George Boy 345-67-3901 B 3 Gerty Gramma 567-89-0123 C 16 Heffalump Harvey 632-79-9439 C 18 Madrigal Jay 309-12-4312 F. 7 Noshow Cecil 345-67-8901 F 19 Osborne Demi 025-24-7821 A 6 Rubble Betty 234-56-7890 C- 17 de Paul Martin 829-34-3412 B+ Ima 96 97 void binarySearch(Student studArray[], Student* indexBy Lastname[], int size) cout > name; 100 101 102 103 104 int first = 0, last = size - 1, middle, position = -1; bool found = false; // First array element // Last array element // Midpoint of search // Position of search value // Flag 105 106 107 108 109 110 111 while (!found && first name) // If value is in lower half 117 last = middle - 1; 118 119 120 121 else 122 first = middle + 1; // If value is in upper half 123 124 125 126 127 128 Student s = *indexBy Lastname [position); cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!