#include #include #include const int ARL=19; using namespace std; struct student { int studentID; double programAvg; double testAvg; }; int buildAr(student a[]); void displayAr( student a[], int b); void sortAr(student a[], int b); void searchAr(student a[], int b, int c); int main() { //initializing a bunch of arrays and such int num, i, studentcount; int search1 = 978179; int search2 = 159753; student student1[ARL]; ifstream inFile; studentcount = buildAr(student1); //calling functions in order needed displayAr(student1, ARL); sortAr(student1, ARL); system("pause"); system("cls"); cout<<"\n\nSORTED LIST: \n\n"; displayAr(student1, ARL); system("pause"); searchAr(student1, search1, search2); system("pause"); return 0; } /********************************************************************************** Function: buildAr Use: Builds the three arrays from the numbers in the text file. Arguments: 1. student[]: the structure that contains the student ID numbers. Returns: nothing **********************************************************************************/ int buildAr(student student1[]) { ifstream inFile; inFile.open("averages.txt" ); if ( inFile.fail() ) { cout << "input file did not open"; exit(0); } /* int num; char str[80]; inFile.getline(str,80); sscanf(str, "%d", &num) */ int i=0; while(!inFile.eof()) { inFile >> student1[i].studentID; inFile >> student1[i].programAvg; inFile >> student1[i].testAvg; i++; } inFile.close(); //return studentID; //return progAvg; //return testAvg; } /********************************************************************************** Function: displayAr Use: Displays all of the arrays in a nice format. Arguments: 1. student[]: the structure that contains the student ID numbers. 2. ARL: the constant that contains the number of elements in the array. Returns: nothing **********************************************************************************/ void displayAr(student student1[],int ARL) { //overallAvg[i]=(student[i].programAvg*.4)+(student[i].testAvg*.6); cout<<"STUDENT ID Progam Average Test average Over All\n"; cout<<"------------------------------------------------------------------\n"; for (int i = 0; i < ARL; i++) { cout<> search; while(z != ARL) { if(student1[z].studentID==search) { cout<<"\n\n\nStudent ID: "<