Ajout du fichier membres et ActivitesJour à jour

master
Antoine PEREDERII 2 years ago
parent cea166d7eb
commit 2421523580

@ -1,2 +1,2 @@
Date nbActivitesJour Date nbActivitesJour
13/05/2022 120 13052022 120

16
SAE.c

@ -5,7 +5,7 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
int i = 0, j = 0; int i = 0, j = 0;
int NoCarte, age, pointsCarte, CarteActive; int NoCarte, age, pointsCarte, CarteActive;
int Date, nbActivitesJour; int Date, nbActivitesJour;
FILE *flot *jour; FILE *flot, *jour;
flot = fopen("membres.don", "r"); flot = fopen("membres.don", "r");
jour = fopen("ActivitesJour.don", "r"); jour = fopen("ActivitesJour.don", "r");
if(flot == NULL) if(flot == NULL)
@ -18,8 +18,8 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
printf("Pb d'ouverture du fichier ActivitesJour.don\n"); printf("Pb d'ouverture du fichier ActivitesJour.don\n");
return -1; return -1;
} }
fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &nom, &prenom, &age, &pointsCarte, &CarteActive, &nbActivitéesJour); fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
fscanf(jour, "%d%d", &Date, &nbActivitéesJour); fscanf(jour, "%d%d", &Date, &nbActivitesJour);
while(!feof(flot)) while(!feof(flot))
{ {
if(i == tmax) if(i == tmax)
@ -32,7 +32,7 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
tage[i] = age; tage[i] = age;
tPointsCarte[i] = pointsCarte; tPointsCarte[i] = pointsCarte;
tCarteActive[i] = CarteActive; tCarteActive[i] = CarteActive;
fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &nom, &prenom, &age, &pointsCarte, &CarteActive, &nbActivitéesJour); fscanf(flot, "%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
i++; i++;
} }
while(!feof(jour)) while(!feof(jour))
@ -43,16 +43,16 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
fclose(jour); fclose(jour);
return -1; return -1;
} }
Date[j] = Date; tDate[j] = Date;
tNbActivitesJour[j] = nbActivitesJour; tNbActivitesJour[j] = nbActivitesJour;
fscanf(jour, "%d%d", &Date, &nbActivitéesJour); fscanf(jour, "%d%d", &Date, &nbActivitesJour);
j++; j++;
} }
fclose(jour); fclose(jour);
fclose(flot); fclose(flot);
return i; return i;
} }
/*
void pointsBonus() void pointsBonus()
{ {
@ -100,4 +100,4 @@ int FrequenceCentre()
{ {
} }
*/

@ -2,7 +2,9 @@
#include <stdlib.h> #include <stdlib.h>
int Ouverture(); int Ouverture();
void testOuverture();
/*
int pointsBonus(); int pointsBonus();
void sauvegarde(); void sauvegarde();
int CreationAdherent(); int CreationAdherent();
int FrequenceCentre(); int FrequenceCentre();*/

BIN
exe

Binary file not shown.

@ -1 +1 @@
Ncarte nom prenom age pointsCarte carteActive nbActivitesJour Ncarte age pointsCarte carteActive

@ -3,12 +3,17 @@
void testOuverture() void testOuverture()
{ {
int tNoCarte[500], tage[500], tPointsCarte[500], tCarteActive[500]; int tNoCarte[500], tage[500], tPointsCarte[500], tCarteActive[500];
int Date[500], tNbActivitesJour[500]; int tDate[500], tNbActivitesJour[500];
int tmax = 500, pas; int tmax = 500, pas, i;
pas = Ouverture(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, &tmax); pas = Ouverture(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, &tmax);
printf("Pas: %d", &pas);
printf("Ncarte nom prenom age pointsCarte carteActive nbActivitesJour\n");
for(i=0; i < pas; i++)
printf("\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i], tNbActivitesJour[i], tDate[i], &tmax);
} }
int main(void) int main(void)
{ {
testOuverture();
return 0; return 0;
} }
Loading…
Cancel
Save