Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [100pts] Consider the following partial program hw.cpp
    
    // hw.cpp
    #include "student.h"
    
    int main() {
      int n = 0;
      Student* stu = readfile(n);
    
      sort(stu, n);
    
      print(stu, n);
    
      return 0;
    }
    
    The program is supposed to do as follows:
    1. Read in a file like grades.txt containing m homework grades for n students (each row consists of the m grades for one student).
    2. Print out the scores along with the averages in increasing order of average.
    Note that the file states how many students and how many grades per student. A run of your program should look like:
    ~/$ ./a.out
    File name: grades.txt
    Caitlyn Zoom avg=57.9 67 45 83 38 88 45 23 78 30 82 
    Edward Needham avg=71.1 89 52 90 67 56 90 95 63 52 57 
    Andy Smith avg=71.9 97 65 63 89 69 84 51 78 68 55 
    Rebecca Wright avg=72.4 76 85 77 95 87 72 64 62 55 51 
    Benjamin Adams avg=73.5 58 96 65 72 93 67 59 74 95 56 
    Jason Rafter avg=74.2 96 66 58 71 87 59 81 78 69 77 
    Aaron Landau avg=76.5 76 97 88 69 64 94 54 75 83 65 
    Jake McCrary avg=78.4 61 91 56 62 81 91 92 91 61 98 
    John Poe avg=80 96 96 84 68 54 98 80 55 73 96 
    Thomas Brown avg=81.3 96 67 56 74 94 100 98 68 95 65 
    Julie Jones avg=84.3 88 81 94 59 95 65 98 88 93 82 
    

    To do:

    Tip: Your structure Student probably also needs to hold the information about how many grades each student has.

    Turn In a printout of your source code files (i.e., student.h, student.cpp) along with a screen capture showing the output of your program.