CJCoding With Joseph
15free / daySign inCreate account

First 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
Topics
Structs
Auto-input
3\nAlice 85\nBob 92\nCara 78
This input is automatically fed to your program's stdin
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.