Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [100pts] Write a program that reads in a file like grades.txt containing m homework grades for n students (each row consists of the m grades for one student) and prints out the scores along with the averages in decreasing 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:
    ~/$ ./hw
    File name: grades.txt
    81 91 86 82 81 91 92 avg = 86.2857
    96 67 56 74 94 99 98 avg = 83.4286
    88 81 94 59 95 65 98 avg = 82.8571
    76 85 77 95 87 72 64 avg = 79.4286
    76 97 88 69 64 94 54 avg = 77.4286
    96 84 68 54 98 80 55 avg = 76.4286
    96 66 58 71 87 59 81 avg = 74
    97 65 63 89 69 84 51 avg = 74
    58 96 65 72 93 67 59 avg = 72.8571
    79 52 80 67 56 80 75 avg = 69.8571
    

    Tip: You may want to add one more parameter to the functions selectionsort() and before().

    Turn In a printout of your source code along with a screen capture showing the output of your program.