Students names and their scores. Ana 87 79 91 Beatrice 78 89 96 Bethan 83 94 93
ID: 644770 • Letter: S
Question
Students names and their scores.
Ana 87 79 91
Beatrice 78 89 96
Bethan 83 94 93
Juan 93 100 86
Joanne 72 85 82
Patrick 80 92 100
Rita 92 91 74
Suzan 67 91 97
Wallace 93 99 91
Wesley 82 91 99
ZZZ
Write a program that prints the students names and average scores ordered by score. Use the Selection Sort algorithm to do the sorting. define two parallel arrays in your program, one to hold the student names and one to hold the average scores. You will have to alter the sorting function a little to be able to make the necessary changes to the array holding the names. Declare a constant to hold the maximum size of the arrays and make sure that your program doesn't read more records than the array size.
You will need to implement at least these functions:
getData
calcAverage
printReport
selectionSort
The main function should only call these functions, nothing else.
Also, let the user enter the file name instead of hardcoding it in your program.
Explanation / Answer
#include
#include
#define N 10
void main()
{ char student[N][100];
int score[N][3];
int scr[N];
getData();
calcAverage();
selectionSort();
printResult();
}
void getaData()
{
for(int i=0;i
{ printf(