42 lines
771 B
C
42 lines
771 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, char const *argv[])
|
|
{
|
|
FILE *f;
|
|
f=fopen("top10","r");
|
|
int zone_int[1];
|
|
int zone_char[3];
|
|
int i = 0;
|
|
int j;
|
|
char name[3];
|
|
int score;
|
|
char rep_n;
|
|
int rep_s;
|
|
printf("Entrez pseudo : ");
|
|
while(i<3){
|
|
name[i] = getchar();
|
|
i++;
|
|
}
|
|
printf("Entrez score : ");
|
|
scanf("%d", score);
|
|
if(f != NULL){
|
|
for(i=0 ; i<10 ; i++){
|
|
fread(zone_int, 4, 1, f);
|
|
fread(zone_char, 3, 1, f);
|
|
if(zone_int[0] <= score){
|
|
rep_n = zone_int[1];
|
|
rep_s = zone_char[3];
|
|
zone_int[0] = score;
|
|
zone_char[3] = name[3];
|
|
name[3] = rep_n;
|
|
score = rep_s;
|
|
}
|
|
printf("%09d", zone_int[0]);
|
|
printf("%c%c%c", zone_char[0], zone_char[1], zone_char[2]);
|
|
}
|
|
}
|
|
fclose(f);
|
|
return 0;
|
|
} |