Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main() {
- int n;
- scanf("%d", &n);
- char name[50];
- int score = 0;
- char findName[50];
- int gotAns = -1;
- for (int i = 0; i < n; i++) {
- fflush(stdin);
- gets(name);
- fflush(stdout);
- scanf("%d", &score);
- if(score > gotAns) {
- strcpy(findName, name);
- gotAns = score;
- }
- }
- printf("%s\n%d\n", findName, gotAns);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement