diff --git a/ActivitesJour.don b/ActivitesJour.don index 7224ff2..5bad8fd 100644 --- a/ActivitesJour.don +++ b/ActivitesJour.don @@ -1,2 +1,11 @@ Date nbActivitesJour 13052022 120 +0 0 +5 5 +7 7 +8 8 +8 8 +6 6 +6 6 +2 2 +1 1 diff --git a/SAE.c b/SAE.c index 1f85ed6..832b8a0 100644 --- a/SAE.c +++ b/SAE.c @@ -52,29 +52,43 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[] fclose(flot); return i; } -/* -void pointsBonus() -{ -} - -void Sauvegarde(int tNoCarte[],int tnom[], int tprenom[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitéesJour[], int nbelem) +int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem) { - int i; - FILE *flot; - flot = fopen("membres.don", "w"); + int i, j; + FILE *flot, *jour; + flot = fopen("membres.don", "a"); + jour = fopen("ActivitesJour.don", "a"); if(flot == NULL) { printf("Pb d'ouverture du fichier membres.don\n"); return -1; } + if(jour == NULL) + { + printf("Pb d'ouverture du fichier ActivitesJour.don\n"); + return -1; + } for(i = 0; i < (nbelem-1); i++) { - fprintf(flot, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tnom[i], tprenom[i], tage[i], tPointsCarte[i], tCarteActive[i], tNbActivitéesJour[i]); + fprintf(flot, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i]); } + for(j = 0; j < (nbelem-1); j++) + { + fprintf(jour, "%d\t%d\n", tDate[j], tNbActivitesJour[j]); + } + fclose(jour); fclose(flot); } +/* +void pointsBonus() +{ + +} + + + int rechercheEtCreation(int tNoCarte[], int nbClients) { int NoCarte, i; diff --git a/SAE.h b/SAE.h index f8e73d7..763d783 100644 --- a/SAE.h +++ b/SAE.h @@ -1,10 +1,11 @@ #include #include -int Ouverture(); -void testOuverture(); +int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tmax); +void testOuverture(void); +int Sauvegarde(); +void testSauvegarde(void); /* int pointsBonus(); -void sauvegarde(); int CreationAdherent(); int FrequenceCentre();*/ \ No newline at end of file diff --git a/exe b/exe index 9d74693..2b7b449 100755 Binary files a/exe and b/exe differ diff --git a/membres.don b/membres.don index 8a686ff..38a0d9a 100644 --- a/membres.don +++ b/membres.don @@ -1 +1,10 @@ Ncarte age pointsCarte carteActive +0 0 0 0 1691030928 1691028928 1691032928 +5 5 5 5 1691030928 1691028928 1691032928 +7 7 7 7 1691030928 1691028928 1691032928 +8 8 8 8 1691030928 1691028928 1691032928 +8 8 8 8 1691030928 1691028928 1691032928 +6 6 6 6 1691030928 1691028928 1691032928 +6 6 6 6 1691030928 1691028928 1691032928 +2 2 2 2 1691030928 1691028928 1691032928 +1 1 1 1 1691030928 1691028928 1691032928 diff --git a/testSAE.c b/testSAE.c index 1b85ce7..7a0e73f 100644 --- a/testSAE.c +++ b/testSAE.c @@ -1,19 +1,27 @@ #include "SAE.h" -void testOuverture() +void testOuverture(void) { - int tNoCarte[500], tage[500], tPointsCarte[500], tCarteActive[500]; - int tDate[500], tNbActivitesJour[500]; + int tNoCarte[500] = {0}, tage[500] = {0}, tPointsCarte[500] = {0}, tCarteActive[500] = {0}; + int tDate[500] = {0}, tNbActivitesJour[500] = {0}; 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"); + printf("Ncarte age pointsCarte carteActive nbActivitesJour Date taillemax\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); + printf("\t%d\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); +} + +void testSauvegarde(void) +{ + int tNoCarte[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tage[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tPointsCarte[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tCarteActive[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}; + int tDate[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}, tNbActivitesJour[500] = {0, 5, 7, 8, 8, 6, 6, 2, 1, 0}; + Sauvegarde(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, 10); } int main(void) { - testOuverture(); + //testOuverture(); + testSauvegarde(); return 0; } \ No newline at end of file