#if 0 /********************************************* This program reads in student/grade data from namedgrades.txt, gets a name from the user and prints out his homework average. **********************************************/ #include #include #include using namespace std; /********************************************* ** PROTOTYPES & STRUCT DEFINITIONS *********************************************/ struct Student { string name; int *grades; // all the homeworks }; int find(string name, Student* students, int size); /********************************************* ** MAIN FUNCTION *********************************************/ int main() { // Open file and read header info int i,j; int Ns, Nh; string junk; ifstream IN("namedgrades.txt"); IN >> Ns >> junk >> Nh >> junk; // create the students array Student *students; students = new Student[Ns]; // create the grades array for each student for (i=0; i> students[i].name; for (j=0; j> students[i].grades[j]; } } // ask user what student we're interested in string name; cout << "Enter student's name: "; cin >> name; // find index of that student in our array int index = find(name, students, Ns); // print that student's average homework score int totalsum = 0; for (i=0;i