From efa6e4febb04f9e5426a22ddf6e77b502822a604 Mon Sep 17 00:00:00 2001 From: "antoine.perederii" Date: Thu, 17 Nov 2022 11:27:12 +0100 Subject: [PATCH] =?UTF-8?q?modifications=20ecommand=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GestionAdherents.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GestionAdherents.c b/GestionAdherents.c index a9732a8..82f9f5c 100644 --- a/GestionAdherents.c +++ b/GestionAdherents.c @@ -13,7 +13,7 @@ * \param nbElem taille logique du tableau * \param noCarte numéro de la carte à rechercher */ -int RechercheAjoutAdherent(int tNoCarte[], int nbElem, int noCarte) +int RechercheAjoutAdherent(int tNoCarte[], int nbElem) { int i; while(i < nbElem) @@ -47,13 +47,13 @@ int AjoutAdherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActi printf("Donnez l'âge de l'adhérent : "); scanf("%d", &age); pas = RechercheAjoutAdherent(tNoCarte, nbElem, noCarte); + if (j == tMax) + { + printf("Tableau plein, impossible d'ajouter un adhérent.\n"); /* Pas besoins de le mettre dans la boucle for */ + return -1; + } for (j = nbElem; j > pas; j--) { - if (j == tMax) - { - printf("Tableau plein, impossible d'ajouter un adhérent.\n"); /* Pas besoins de le mettre dans la boucle for */ - return -1; - } tNoCarte[j] = tNoCarte[j - 1]; tAge[j] = tAge[j - 1]; tPointsCarte[j] = tPointsCarte[j - 1];