1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <stdio.h>
int main (void)
{
FILE *fe = fopen ("notes.txt", "r");
if (fe == NULL)
{
printf ("\nErreur d'ouverture du fichier des notes.\n");
}
else
{
int numRech;
char nomRech[6+1];
char mdpRech[6+1];
float notes[4];
while (fscanf (fe, "%d %6s %6s %f %f %f %f", &numRech, nomRech, mdpRech,
¬es[0], ¬es[1], ¬es[2], ¬es[3]) == 7)
{
printf ("%d %s %s %.2f %.2f %.2f %.2f\n", numRech, nomRech, mdpRech,
notes[0], notes[1], notes[2], notes[3]);
}
fclose (fe);
}
return 0;
} |
Partager