CJCoding With Joseph

Read Students and Print the Top Scorer

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:

Bob

Assume all scores are distinct. There is no trailing newline.

Expected Output:

Bob
Topics:
Structs
๐Ÿ“ฅ Auto-Input:
3\nAlice 85\nBob 92\nCara 78
This input is automatically fed to your program's stdin
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.