diff --git a/adherent.c b/adherent.c new file mode 100644 index 0000000..5ee9daa --- /dev/null +++ b/adherent.c @@ -0,0 +1,59 @@ +#include "../adherent.h" + +/** + * @brief Supprime un adherent + * + * @param nbAdherent [POINTEUR] Nombre d'adhérent total + * @param tabNoCarte [TABLEAU] Liste des numéros de cartes des adhérents + * @param tabEtatCarte [TABLEAU] Liste des états des cartes des adhérents + * @param tabPointCarte [TABLEAU] Liste des points sur les cartes des adhérents + * @return int Code erreur : 0 -> Tout s'est bien passé | 1 -> Adhérent pas trouvé + */ +int SupprimerAdherent(int *nbAdherent, int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[]) +{ + int cible; + char rep = 'N'; + + printf("\nBienvenue sur le menu de suppression d'adherents.\nEntrer le numero de la carte de l'adherent que vous souhaitez supprimer : "); + scanf("%d", &cible); + + // Verification de l'existance de l'adherent + + int trouve = 0; + + for (int i = 0; i < *nbAdherent ; i++) + { + if (tabNoCarte[i] == cible) + { + trouve = 1; + break; + } + } + + // Si la carte de l'adherent n'existe pas + if (trouve == 0) + { + printf("\nNumero de carte %d inexistant. Souhaitez vous un affichage détaille des adherents (O/N) : "); + scanf("%*c%c", &rep); + + // Verification de la validité de la réponse + while (rep != 'N' && rep != 'O') + { + printf("Reponse incorrecte. Souhaitez vous un affichage détaille des adherents (O/N) : "); + scanf("%*c%c", &rep); + } + + if (rep == 'O') + { + // APPEL DE L'AFFICHAGE DES ADHERENTS + } + } + + if (rep == 'O') + { + printf("Souhaitez vous entrer un autre numéro d'adhérent"); + } + + return 0; + +} \ No newline at end of file diff --git a/adherent.h b/adherent.h new file mode 100644 index 0000000..9a151cd --- /dev/null +++ b/adherent.h @@ -0,0 +1,4 @@ +#include + +int SupprimerAdherent(int *nbAdherent, int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[]); + diff --git a/main.c b/main.c index e69de29..8603a89 100644 --- a/main.c +++ b/main.c @@ -0,0 +1,14 @@ +#include "adherent.h" + +int main(void){ + int tabCarte[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; + int tabEtat[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1}; + int tabPoint[10] = {0}; + + int taillePhysique = 10; + int tailleLog = 9; + + int err = SupprimerAdherent(&tailleLog, tabCarte, tabEtat, tabPoint); + + printf("\nCode erreur : %d\n", err); +} \ No newline at end of file