36 lines
632 B
C
36 lines
632 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<string.h>
|
|
|
|
int main(int argc, char * argv[]) {
|
|
FILE* flux;
|
|
flux = fopen("top10", "r");
|
|
|
|
char name1[4] = "aaa";
|
|
char name2[4] = "bbb";
|
|
char name3[4] = "ccc";
|
|
|
|
if (flux) {
|
|
do {
|
|
int score;
|
|
char* name = calloc(3, sizeof(char));
|
|
fread(&score, 4, 1, flux);
|
|
fread(name, 1, 3, flux);
|
|
|
|
if (feof(flux)) break;
|
|
|
|
strcpy(name3, name2);
|
|
strcpy(name2, name1);
|
|
strcpy(name1, name);
|
|
} while (!feof(flux));
|
|
|
|
printf("1ere place : %s\n", name1);
|
|
printf("2eme place : %s\n", name2);
|
|
printf("3eme place : %s\n", name3);
|
|
|
|
fclose(flux);
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|