Home > Net > C # how to an array of classified summary
C # how to an array of classified summary
Time:11-26
Such as an array of the row five columns have a 9 string [9, 5] Input_Data Stored inside the {1 class, zhang, male, 85, mathematics} {1 class, li si, male, 72, Chinese} {2 class, Cathy, female, 85, mathematics} {2 class, zhang, female, 88, Chinese} {1 class, zhang, male, 76, English} {2 class, zhang, female, 98, mathematics} {1 class, li si, male, 98, mathematics} {2 class, Cathy, female, 95, English} {1 class, zhang, male, 80, Chinese} How to through the first three columns completely consistent, the fourth column sum score, Produces the following results of string array [and] Output_Data {1 class, zhang, male, 241, the total score} {1 class, li si, male, 170, the total score} {2 class, Cathy, female, 180, total score} {2 class, zhang, female, 186, the total score}
CodePudding user response:
1, one end in the database directly through the query results; 2, traverse again, before the three as the key, the fourth as values, to generate a dictionary, does not exist, it added, there is added value,