11-11-2018 08:34 PM
I have been trying to build a grade book which takes an array with a students name, exam1 exam2 final exam outputs an average in both numeric and letter form. I also want it to sort the students from highest average. I have gotten the program to do all of this except one final thing. Once it sorts the students from highest to lowest grade based on average i also need it to display number rank such as 1, 2, 3, 4 next to the student. Example Name Score Grade Rank
Sam 90 A 1
Tim 88 B 2 etc.
Any help would be great i have tried so many things but am having trouble.
11-12-2018 03:20 AM
@paramedic wrote:
Any help would be great i have tried so many things but am having trouble.
Care to tell us what the problem is? Besides the slobby wiring...
11-12-2018 03:47 AM
You just need to add a # field to your cluster and in the 2nd loop, set it to N-i.
/Y
11-12-2018 05:02 AM
@Yamaeda wrote:
You just need to add a # field to your cluster and in the 2nd loop, set it to N-i.
/Y
Ah, that was the problem... Monday morning...
Alternatively, in the 3rd loop set it to i+1. Might be a bit more intuitive.
In >LV17 there is a vim to sort 2D arrays on a specific column. Doesn't solve this problem, but makes more sense to use what's available. It opens doors to sorting on a given column,
11-12-2018 05:09 AM
wiebe@CARYA wrote:
@Yamaeda wrote:
You just need to add a # field to your cluster and in the 2nd loop, set it to N-i.
/Y
Ah, that was the problem... Monday morning...
Alternatively, in the 3rd loop set it to i+1. Might be a bit more intuitive.
In >LV17 there is a vim to sort 2D arrays on a specific column. Doesn't solve this problem, but makes more sense to use what's available. It opens doors to sorting on a given column,
My bad, the 3rd loop! It should still be N-i, since it's reversed afterwards. 😉
/Y
11-12-2018 07:07 AM
@Yamaeda wrote:
wiebe@CARYA wrote:
@Yamaeda wrote:
You just need to add a # field to your cluster and in the 2nd loop, set it to N-i.
/Y
Ah, that was the problem... Monday morning...
Alternatively, in the 3rd loop set it to i+1. Might be a bit more intuitive.
In >LV17 there is a vim to sort 2D arrays on a specific column. Doesn't solve this problem, but makes more sense to use what's available. It opens doors to sorting on a given column,
My bad, the 3rd loop! It should still be N-i, since it's reversed afterwards. 😉
/Y
Right again, of course (still Monday).
I'd do the sort, then reverse, then build the new array. Makes more sense to me... Then you can use i+1.
Anyway, looks like the original question has been answered? OP still listening?
11-13-2018 11:47 AM
Yes thank you all for your help.