Lab 2 Ex 3: Strength Ranking

Lab 2 Ex 3: Strength Ranking

You cannot submit for this problem because the homework's deadline is due.

Problem: In a high school, all final exam grades have been released. The teachers want to rank the students according to their total score. If two students have the same total score, just keep the order the same as in the input. As a programming expert, can you help design a system that solves this problem elegantly?

Requirement: You are required to use a struct to store information for each soldier. Also, you are required to use qsort() in <cstdlib> to achieve sorting. Check http://www.cplusplus.com/reference/cstdlib/qsort/ on how to use that.

Input Format: The first line: an integer n (1<= n <= 10) that stands for the number of students. The following \(n\) lines: Name(string) ChineseScore(int) MathScore(int) EnglishScore(int). You can assume that there is no space in name and the length is less than 16.

# sample
3
Eren 9 10 3
Mikasa 10 9 8
Levi 11 10 8

Output Format: Students sorted in descending total score.

# sample
Levi 11 10 8
Mikasa 10 9 8
Eren 9 10 3

Tags: #function #struct #qsort #pointer

Lab 2

Not Claimed
Status
Finished
Problems
3
Open Since
2022-05-24 00:00
DDL
2022-05-31 23:59
Extension
72.0 hour(s)