Hi,I have an array called int totalscores[300] that is sorted in descending, so it ranges from highest scores to lowest. How would I attach or link a grade according to what position the scores are in the array?
After linking the total scores to the respective grade, I want to :
1. Adjust the total scores
2. Sort the adjusted total scores in descending order
3. And then compare the grade before and after the scores were adjusted to see how many students were promoted and demoted to a different grade after the adjustment was done by seeing what position the grades are after, so for ex.
If there's 5 scores,
300 , 200 ,100, 90, 43, 20
I would like to link it as
300 - A
200 - B
100 - C
43 - D
20 - F
and then apply an adjustment on the total score, while retaining the linked grade, so perhaps the 300 becames 149, the 200 becomes 320, etc.
149 - A
320 - B
100 - C
50 - D
60 - F
and then sort the scores descending:
320 - B
149 - A
100 - C
60 - F
50 - D
and then compare the values to before it was adjusted and see how many scores got promoted or demoted from A,B,C,D,F.
So far, I thought of making a char array
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
char grades[300];
for (int i = 0; i<45; i++)
{
grades[i] = 'A'
}
for (int i = 46; i<104; i++)
{
grades[i] = 'B'
}
for (int i = 105; i<179; i++)
{
grades[i] = 'C'
}
for (int i = 180; i<239; i++)
{
grades[i] = 'D'
}
for (int i = 240; i<299; i++)
{
grades[i] = 'F'
}
|
But, I'm stuck on how I be able to link the char array to the int totalscores[300]?
And then after that, I'm not sure how to adjust the scores, while retaining the link and then sorting it again, and comparing it to the original link.
So far, I just have 3 arrays: grades[300], totalscores[300], newt[300].
grades[300] and totalscores[300] correspond to each other via the index.
totalscores[300] and newt[300] correspond to each other via the index as well, but my only missing piece is sorting the newt[300] while keeping track of what grade it initially got.