Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed**8

image text in transcribed

#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

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions