Read Students and Print the Top Scorer
hardQuestion 420First read an integer n from standard input, then read n lines, each with a student's name (a single word) and their integer score. Store each into a struct Student { char name[32]; int score; } and print the name of the student with the highest score. For the input
3 Alice 85 Bob 92 Cara 78
the output is exactly what is shown in Expected Output.
Assume all scores are distinct. There is no trailing newline.
Expected output
Bob= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.