diff --git a/ActivitesJour.don b/ActivitesJour.don index 5bad8fd..af64d63 100644 --- a/ActivitesJour.don +++ b/ActivitesJour.don @@ -1,11 +1,10 @@ -Date nbActivitesJour -13052022 120 -0 0 -5 5 -7 7 -8 8 -8 8 -6 6 -6 6 -2 2 -1 1 + Date nbActivitesJour +12082022 500 +5092022 525 +7092022 740 +8092022 812 +9092022 850 +10092022 620 +11092022 601 +12092022 422 +13092022 501 diff --git a/SAE.c b/SAE.c index 832b8a0..ad76707 100644 --- a/SAE.c +++ b/SAE.c @@ -71,30 +71,47 @@ int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[ } 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], tage[i], tPointsCarte[i], tCarteActive[i]); + fprintf(flot, "\t%d\t%d\t\t%d\t\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]); + fprintf(jour, "%d\t\t%d\n", tDate[j], tNbActivitesJour[j]); } fclose(jour); fclose(flot); } -/* -void pointsBonus() +int ajoutPointsCarte(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbelem) { - + int i, NoCarte, pointsCarte, CarteActive; + printf("Entrez le numero de carte de l'adherent: "); + scanf("%d", &NoCarte); + for(i = 0; i < nbelem; i++) + { + if(NoCarte == tNoCarte[i]) + { + printf("Entrez le nombre de points a ajouter: "); + scanf("%d", &pointsCarte); + tPointsCarte[i] += pointsCarte; + printf("Le nombre de points de l'adherent est maintenant de %d\n", tPointsCarte[i]); + if(tPointsCarte[i] >= 1000) + { + tCarteActive[i] = 1; + printf("La carte de l'adherent est maintenant active\n"); + } + return 0; + } + } + printf("Le numero de carte n'existe pas\n"); + return -1; } - - -int rechercheEtCreation(int tNoCarte[], int nbClients) +int rechercheEtCreation(int tNoCarte[], int nbelem) { int NoCarte, i; - for( i=0; i < nbClients; i++) + for( i=0; i < nbelem; i++) { - if(i != tNoCarte[i]) + if((i + 1) != tNoCarte[i]) { return i; } @@ -102,6 +119,52 @@ int rechercheEtCreation(int tNoCarte[], int nbClients) return i; } +int CreationAdherents(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem) +{ + int NoCarte, age, pointsCarte, CarteActive, pas; + char reponse; + printf("Donnez l'âge du client :\n"); + scanf("%d", &age); + pas = rechercheEtCreation(tNoCarte, nbelem); + for(j=nbelem; j> pas; j--) + { + tNoCarte[j] = tNoCarte[j-1]; + tage[j] = tage[j-1]; + tPointsCarte[j] = tPointsCarte[j-1]; + tCarteActive[j] = tCarteActive[j-1]; + } + tNoCarte[pas] = + tMatieres[i]= matieres; + tCoeff[i] = coeff; + nbMatieres = nbMatieres + 1; + return nbMatieres; + tNoCarte[pas] = tNoCarte[pas] + 1; + tage[pas] = age; + tPointsCarte[pas] = 0; + tCarteActive[pas] = 0; + printf("Le numero de carte de l'adherent qui a %d ans est %d.\nLa carte n'est pas active car il n'y a pas de points dessus.\nVoulez-vous en ajouter ? (O / N)", tage[pas], tNoCarte[pas]); + scanf("%*c%c", &reponse); + if(reponse == 'O' || reponse == 'o') + { + printf("Entrez le nombre de points a ajouter: "); + scanf("%d", &pointsCarte); + if(pointsCarte > 0) + tPointsCarte[pas] = tPointsCarte[pas] + pointsCarte; + printf("Le nombre de points de l'adherent est maintenant de %d\nVotre carte est désormais", tPointsCarte[pas]); + } + nbelem = nbelem + 1; +} + +/* +void pointsBonus() +{ + +} + + + + + int CreationAdherents(int tAdherents[], nbClients) { int NoCarte, nom, prenom, age, pointsCarte, CarteActive, nbActivitéesJour; diff --git a/exe b/exe index 2b7b449..5d118ea 100755 Binary files a/exe and b/exe differ diff --git a/membres.don b/membres.don index 38a0d9a..01fe651 100644 --- a/membres.don +++ b/membres.don @@ -1,10 +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 + 1 22 10 0 + 2 25 5 1 + 3 47 7 1 + 4 38 8 1 + 5 18 8 1 + 6 46 6 1 + 7 36 6 0 + 8 19 2 1 + 9 21 1 1 diff --git a/testSAE.c b/testSAE.c index 7a0e73f..68e76aa 100644 --- a/testSAE.c +++ b/testSAE.c @@ -14,8 +14,8 @@ void testOuverture(void) 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}; + int tNoCarte[500] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, tage[500] = {22, 25, 47, 38, 18, 46, 36, 19, 21, 30}, tPointsCarte[500] = {10, 5, 7, 8, 8, 6, 6, 2, 1, 4}, tCarteActive[500] = {0, 1, 1, 1, 1, 1, 0, 1, 1, 1}; + int tDate[500] = {12082022, 5092022, 7092022, 8092022, 9092022, 10092022, 11092022, 12092022, 13092022, 14092022}, tNbActivitesJour[500] = {500, 525, 740, 812, 850, 620, 601, 422, 501, 520}; Sauvegarde(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, 10); }