#include #include #include using namespace std; int buildAr(int a[], float b[], float c[],float d[]); void displayAr( int a[], float b[], float c[],float d[], int e); void sortAr(int a[], float b[], float c[], int e); void searchAr(int a[], float b[], float c[], float d[], int e); int main() { int ARL=18; int studentID[ARL]; float progAvg[ARL]; float testAvg[ARL]; float overallAvg[ARL]; int num, i, studentcount; ifstream inFile; studentcount = buildAr(studentID,progAvg,testAvg,overallAvg); displayAr(studentID,progAvg,testAvg,overallAvg,ARL); sortAr(studentID,progAvg,testAvg,studentcount); system("pause"); system("cls"); cout<<"\n\nSORTED LIST: \n\n"; displayAr(studentID,progAvg,testAvg,overallAvg,ARL); system("pause"); searchAr(studentID,progAvg,testAvg,overallAvg,ARL); system("pause"); return 0; } /********************************************************************************** Function: buildAr Use: Builds the three arrays from the numbers in the text file. Arguments: 1. studentID[]: the array that contains the student ID numbers. 2. progAvg[]: the array that contains the program grade averages. 3. testAvg[]: the array that contains the test grade averages. 4. overallAvg[]: the array that contains the overall grade averages. Returns: nothing **********************************************************************************/ int buildAr(int studentID[], float progAvg[], float testAvg[], float overallAvg[]) { ifstream inFile; inFile.open("averages.txt" ); if ( inFile.fail() ) { cout << "input file did not open"; exit(0); } int i=0; while(!inFile.eof()) { inFile >> studentID[i]; inFile >> progAvg[i]; inFile >> testAvg[i]; overallAvg[i]=(progAvg[i]*.4)+(testAvg[i]*.6); i++; } inFile.close(); //return studentID; //return progAvg; //return testAvg; } /********************************************************************************** Function: displayAr Use: Displays all of the arrays in a nice format. Arguments: 1. studentID[]: the array that contains the student ID numbers. 2. progAvg[]: the array that contains the program grade averages. 3. testAvg[]: the array that contains the test grade averages. 4. overallAvg[]: the array that contains the overall grade averages. 5. ARL: the constant that contains the number of elements in the array. Returns: nothing **********************************************************************************/ void displayAr( int studentID[], float progAvg[], float testAvg[], float overallAvg[], int ARL) { cout<<"STUDENT ID Progam Average Test average Over All\n"; cout<<"------------------------------------------------------------------\n"; for (int i = 0; i < ARL; i++) { cout<last) { last=sstudentID[i]; cout<<"HERE!"; } y++; } } studentID[i]=studentID[y]; progAvg[i]=progAvg[y]; testAvg[i]=testAvg[y]; overallAvg[i]=overallAvg[y]; sstudentID[y]=0; } } */ /********************************************************************************** Function: searchAr Use: Allows the user to search for student ID numbers in the arrays. Arguments: 1. studentID[]: the array that contains the student ID numbers. 2. progAvg[]: the array that contains the program grade averages. 3. testAvg[]: the array that contains the test grade averages. 4. overallAvg[]: the array that contains the overall grade averages. 5. ARL: the constant that contains the number of elements in the array. Returns: nothing **********************************************************************************/ void searchAr( int studentID[], float progAvg[], float testAvg[],float overallAvg[], int ARL) { system("cls"); int search=0; int z=0; cout<<"Please enter the students id: "; cin>> search; while(z != ARL) { if(studentID[z]==search) { cout<<"\n\n\nStudent ID: "<