← Back to Structs
Question 420
Read Students and Print the Top Scorer
Read Students and Print the Top Scorer
First read an integernfrom standard input, then readnlines, each with a student's name (a single word) and their integerscore. Store each into astruct 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.