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
    Filename: grades.txt
    81 91 86 82 81 91 ave = 85.3333
    76 85 77 95 87 72 ave = 82
    76 97 88 69 64 94 ave = 81.3333
    96 67 56 74 94 99 ave = 81
    88 81 94 59 95 65 ave = 80.3333
    96 84 68 54 98 80 ave = 80
    97 65 63 89 69 84 ave = 77.8333
    58 96 65 72 93 67 ave = 75.1667
    96 66 58 71 87 59 ave = 72.8333
    79 52 80 67 56 80 ave = 69
    

    Tip: You may want to add one more parameter (i.e., how many grades per student) to the functions selectionsort() and before().

    Submit: ~/bin/submit -c=IC210 -p=hw29 hw.cpp

    Turn In the codeprint of your source code.