Several friends are participating in a javelin competition. Once the competition has finished, write a program that prints the ranking of the participants according to their result.
The input starts with an integer , the number of participants. On each of the following lines is the name of a participant (as a single word) and the final score of this participant. If you wish, you may assume that each participant has a unique score.
Print an ordered ranking of the participants on the following
format:
K. X: YY.YY
Here, K is the ranking of the participant (in the range 1 to N), X is
the name of the participant and YY.YY is their final score.
Hint: Use "std::setprecision" in the
iomanip
library to print a fixed number of decimal places:
std::cout << std::setprecision( 2 ) << std::fixed << result;
Author: Anders Jonsson
Generation: 2026-01-25T22:33:55.210Z
© Jutge.org, 2006–2026.
https://jutge.org