Question: **8 #include #include #include using namespace std; int searchlinear(int arr[],int id, int size) { int i; for (i= 0; i } int main() { const

**8 #include #include #include using namespace std; int searchlinear(int arr[],int id, intsize) { int i; for (i= 0; i } int main() {const int NUM_ELMTS=18; /etid, MAJOR and GPS are parallel arrays int netID[NUM_ELMTS];string major[NUM_ELMTS]; double GPA[NUM_ELMTS]; //sorted GPA double sortedGPAbyGPA[NUM_ELMTS]; int sortedNetIDbyGPA[NUM_ELMTS]; string sortedMajorbyGPA[NUM_ELMTS];//sorted NetID int sortedNetIDbyID[NUM_ELMTS]; string sortedMajorbyID[NUM_ELMTS]; double sortedGPAbyID[NUM_ELMTS]; int i=0,j,k; int min,max;**8

int index; int ID; int swapID; string swapmajor; double swapGPA; string line;

#include #include #include using namespace std; int searchlinear(int arr[],int id, int size) { int i; for (i= 0; i

} int main() {

const int NUM_ELMTS=18; /etid, MAJOR and GPS are parallel arrays int netID[NUM_ELMTS]; string major[NUM_ELMTS]; double GPA[NUM_ELMTS]; //sorted GPA double sortedGPAbyGPA[NUM_ELMTS]; int sortedNetIDbyGPA[NUM_ELMTS]; string sortedMajorbyGPA[NUM_ELMTS]; //sorted NetID int sortedNetIDbyID[NUM_ELMTS]; string sortedMajorbyID[NUM_ELMTS]; double sortedGPAbyID[NUM_ELMTS]; int i=0,j,k; int min,max; int index; int ID; int swapID; string swapmajor; double swapGPA; string line; string f_name; int choice,n; cout>f_name; ifstream stufile(f_name.c_str());

if (stufile.is_open()) { while (stufile>>line) {

netID[i]=stoi(line); stufile>>line; major[i]=line; stufile>>line; GPA[i]= stod(line); i++; } stufile.close(); for(j=0;j sortedGPAbyGPA[max]) max=k; swapGPA=sortedGPAbyGPA[max]; sortedGPAbyGPA[max]=sortedGPAbyGPA[j]; sortedGPAbyGPA[j]=swapGPA; swapmajor=sortedMajorbyGPA[max]; sortedMajorbyGPA[max]=sortedMajorbyGPA[j]; sortedMajorbyGPA[j]=swapmajor; swapID=sortedNetIDbyGPA[max]; sortedNetIDbyGPA[max]=sortedNetIDbyGPA[j]; sortedNetIDbyGPA[j]=swapID; } // sorting by swapID for (j = 0; j >choice; if(choice==1) { cout>n; for(j=0;j>ID; index=searchlinear(netID, ID,i); if(index>=0) { cout=0) { cout

} }while(choice!=3); } else cout

***this is my code. I need help to make my outputs look like my expected outputs shown in the pictures otherwise I will keep getting errors.

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!