From d74732f40cce7c70a90ced3bfbbf1048c5a34917 Mon Sep 17 00:00:00 2001 From: "antoine.perederii" Date: Fri, 11 Nov 2022 22:09:00 +0100 Subject: [PATCH] =?UTF-8?q?modif=20de=20la=20fonction=20de=20debit=20de=20?= =?UTF-8?q?points=20par=20rapport=20aux=20activit=C3=A9s=20sur=20une=20car?= =?UTF-8?q?te?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Fonctions.h | 3 +- GestionAdherents.c | 2 +- GestionPoints.c | 150 +++++++++++++++++++++++++++++++++++++-------- Global.c | 18 +----- Menus.c | 19 ++++++ exe | Bin 30432 -> 30472 bytes 6 files changed, 148 insertions(+), 44 deletions(-) diff --git a/Fonctions.h b/Fonctions.h index 198fee7..c356e76 100644 --- a/Fonctions.h +++ b/Fonctions.h @@ -9,6 +9,7 @@ int OuvertureActivitesJour(int tNbActivitesJour[], int tDate[], int tMax); /* Fonctions des menus */ int ChoixMenu(void); int ChoixMenuAffichage(void); +int choixMenuActivites(void); /* Fonctions d'affichage */ void Affichage1Adherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int nbElem); @@ -33,4 +34,4 @@ void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbElem) /* Fonctions de gestion des points */ void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbElem, int noCarte); -void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbElem); \ No newline at end of file +void DebitCarte(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int nbElem); \ No newline at end of file diff --git a/GestionAdherents.c b/GestionAdherents.c index 8d68420..9d4f0b3 100644 --- a/GestionAdherents.c +++ b/GestionAdherents.c @@ -150,7 +150,7 @@ void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbElem) scanf("%d", &choix); if (choix == 1) { - printf("\nPourquoi voulez-vous activer la carte ?\n1.\tCarte retrouvée\n2.\tNouvelle carte\n3.\tLevée de sanction\n"); + printf("\nPourquoi voulez-vous activer la carte ?\n1.\tCarte retrouvée\n2.\tNouvelle carte à la place de l'ancienne\n3.\tLevée de sanction\n"); printf("\nOption choisie : "); scanf("%d", &choixRaison); diff --git a/GestionPoints.c b/GestionPoints.c index 11c3c26..7250dba 100644 --- a/GestionPoints.c +++ b/GestionPoints.c @@ -2,7 +2,7 @@ * \file GestionPoints.c * \brief Contient les fonctions pour la gestion des points des adhérents * \author -*/ + */ #include "Fonctions.h" @@ -14,7 +14,7 @@ * \param noCarte numéro de la carte à rechercher * \param trouve pointeur qui prend comme valeur 1 si le numéro a été trouvé et 0 sinon * \return l'index où se trouve le numéro de la carte recherché, s'il n'y est pas, retourne l'endroit où il doit être inséré -*/ + */ int RechercheAdherent(int tNoCarte[], int nbElem, int noCarte, int *trouve) { int i; @@ -41,7 +41,7 @@ int RechercheAdherent(int tNoCarte[], int nbElem, int noCarte, int *trouve) * \param tCarteActive tableau qui contient l'état de chaque carte * \param nbElem taille logique des tableaux * \param noCarte numéro de la carte à créditer -*/ + */ void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbElem, int noCarte) { int pointsCarte, trouve, pas; @@ -95,10 +95,16 @@ void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbE * \param tCarteActive tableau qui contient l'état de chaque carte * \param tNbActivitesJour tableau contenant le nombre d'activité qui a été faite dans la journée * \param nbElem taille logique des tableaux + */ + + +/* + Mettre les points bonus + interdire à un adhérent de fréquenter le centre plus d’une fois par jour */ -void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbElem) +void DebitCarte(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int nbElem) { - int noCarte, trouve, pas, pointsCarte; + int choix, trouve, pas, noCarte; char reponse; printf("Entrez le numéro de la carte de l'adhérent recherché : "); scanf("%d", &noCarte); @@ -107,31 +113,125 @@ void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], { if (tCarteActive[pas] == 1) { - printf("Voulez-vous désactiver cette carte ? (o/n)\n"); - scanf("%*c%c", &reponse); - if (reponse == 'O' || reponse == 'o') + while (choix != 10) { - tCarteActive[pas] = 0; - printf("La carte est desactivée.\n"); - } - else - { - printf("La carte est toujours active.\n"); + choix = choixMenuActivites(); + switch (choix) + { + case 1: + if (tPointsCarte[pas] >= 0) + { + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué la piscine.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 2: + if (tPointsCarte[pas] >= 0) + { + tPointsCarte[pas] = tPointsCarte[pas] - 0; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué l'option accessibilité.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 3: + if (tPointsCarte[pas] >= 5) + { + tPointsCarte[pas] = tPointsCarte[pas] - 5; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué Aquakid + Aquaplouf.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 4: + if (tPointsCarte[pas] >= 9) + { + tPointsCarte[pas] = tPointsCarte[pas] - 9; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué Aquafit.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 5: + if (tPointsCarte[pas] >= 10) + { + tPointsCarte[pas] = tPointsCarte[pas] - 10; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1 ; + printf("Vous avez pratiqué Cours de natation.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 6: + if (tPointsCarte[pas] >= 12) + { + tPointsCarte[pas] = tPointsCarte[pas] - 12; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué Cours de gymnastique aquatique.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 7: + if (tPointsCarte[pas] >= 15) + { + tPointsCarte[pas] = tPointsCarte[pas] - 15; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué Vagues.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 8: + if (tPointsCarte[pas] >= 20) + { + tPointsCarte[pas] = tPointsCarte[pas] - 20; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué Aquabike.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + case 9: + if (tPointsCarte[pas] >= 35) + { + tPointsCarte[pas] = tPointsCarte[pas] - 35; + tNbActivitesJour[pas] = tNbActivitesJour[pas] + 1; + printf("Vous avez pratiqué Aquafamily.\n"); + } + else + { + printf("Vous n'avez pas assez de points.\n"); + } + break; + } + choix = choixMenuActivites(); } } else { - printf("La carte est desactivée. Voulez-vous la réactiver ? (o/n)\n"); - scanf("%*c%c", &reponse); - if (reponse == 'O' || reponse == 'o') - { - tCarteActive[pas] = 1; - printf("La carte est activée.\n"); - } - else - { - printf("La carte est toujours desactivée.\n"); - } + printf("Votre carte est inactive. Veuillez La réactivé.\n"); } } else diff --git a/Global.c b/Global.c index 718800c..1d6028d 100644 --- a/Global.c +++ b/Global.c @@ -6,22 +6,6 @@ #include "Fonctions.h" -/* -A une séance d’une activité donnée correspond un certain nombre de -points. -Exemple : -Une séance de musculation : 10 points -Une séance d’aquagym : 15 points -Une séance de SPA : 12 points - -A chaque entrée au centre, un adhérent peut choisir une ou plusieurs activités en même temps. Il peut -par exemple faire une séance de musculation suivie d’une séance de SPA, sa carte se verra débiter de -22 points. -Attribution de points lors d'un sceance qui dépende de critères socioprofessionnels (retraités, étudiants, ... AGE - -Votre application doit pouvoir interdire à un adhérent de fréquenter le centre plus d’une fois par jour -*/ - /** * \brief Permet de gérer les menus en appelant une fonction pour chaque choix fait par l'utilisateur * \author @@ -93,7 +77,7 @@ void GestionMenus(void) } else if (choix == 7) { - DebitActivitee(tNoCarte, tCarteActive, tNbActivitesJour, nbElem); + DebitCarte(tNoCarte, tPointsCarte, tCarteActive, tNbActivitesJour, nbElem); } choix = ChoixMenu(); } diff --git a/Menus.c b/Menus.c index 13daa06..2faf832 100644 --- a/Menus.c +++ b/Menus.c @@ -46,4 +46,23 @@ int ChoixMenuAffichage(void) printf("\nOption choisie : "); scanf("%*c%c", &choix); return choix; +} + +int choixMenuActivites(void) +{ + int choix; + printf("\nChoix activités :\n"); + printf("1.\tPiscine, \t\t\t0pt\n"); + printf("2.\tOption accessibilité, \t\t0pt\n"); + printf("3.\tAquakid + Aquaplouf, \t\t5pt\n"); + printf("4.\tAquafit, \t\t\t9pt\n"); + printf("5.\tCours de natation, \t\t10pt\n"); + printf("6.\tCours de gymnastique aquatique, 12pt\n"); + printf("7.\tVagues, \t\t\t15pt\n"); + printf("8.\tAquabike, \t\t\t20pt\n"); + printf("9.\tAquafamily, \t\t\t35pt\n"); + printf("10.\tQuitter\n"); + printf("\nOption choisie : "); + scanf("%d", &choix); + return choix; } \ No newline at end of file diff --git a/exe b/exe index e2d36db040085277b11f2d3af9482b713356bab9..f861c5d79b83850834d33e1eb8986616bc9cb1c7 100755 GIT binary patch delta 6009 zcmbVQ3s_Xu7CvVXbr5BE$jE>)f{4$N(L^Kt1aT4#ADEaKdL3ZUQ3PaWxN6d9gi6GX z+}Z7Y^?q4e*0npCX_g?GrrpZ>l`njkHE5X@1}WZi|F!oSRPx?FJ)fMl_P^F%>tE~a zbM|&l|0u7zC|CE9S3T4BR6uFG#IMqL79yJhs>8&vI*g5%KkoV7Br$9&8wD&ivc8(P z!fd<0j$W^wnV4sKZ233lD=ke+Cbf9Hnya04Pxh9iw5rarT#Q^7?fF?ZMkDuQ!$OD1 zsce4eXgQ3%6Ka>Yux??g@bEm^=5;))w;7;Q7#0+umX_x znP#>wBvyWk9YmmKJq`NqvOce$FH(AwqEuQwyATX_9qS$u7h&k@v*}<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