From f9901b923e421c573e1a29af6725b492f2838df9 Mon Sep 17 00:00:00 2001 From: Alexis LAURENT Date: Wed, 2 Nov 2022 01:10:47 +0100 Subject: [PATCH] ajout fonction AlimenterCarte --- fonction.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/fonction.c b/fonction.c index 02874e0..60bcd4c 100644 --- a/fonction.c +++ b/fonction.c @@ -156,3 +156,57 @@ void afficheNbEntreAct(int tabNbEntree[], int tabPoint[], int tphys) } + +void alimenterCarte (int tabAdherent[], int tabPoint[],int nb) +{ + int num, trouve, i; + char formule; + printf("numero carte :"); + scanf("%d",&num); + i = recherche(tabAdherent, num, nb, &trouve); + if (trouve == 1) + { + printf("Qu'elle formule :\n"); + printf("A : 5€ -> 5 points\n"); + printf("B : 10€ -> 12 point\n"); + printf("C : 15€ -> 20 point\n"); + printf("Choisir :"); + scanf("%*c%c", &formule); + while (formule != 'A' || formule != 'B' || formule != 'C') + { + printf("Erreur récupération de donnée\n"); + printf("A : 5€ -> 5 points\n"); + printf("B : 10€ -> 12 point\n"); + printf("C : 15€ -> 20 point\n"); + printf("Choisir :"); + scanf("%*c%c", &formule); + } + if (formule == 'A') + { + tabAdherent[i] = tabAdherent[i] + 5; + printf("accréditation de 5 points\n"); + } + if (formule == 'B') + { + tabAdherent[i] = tabAdherent[i] + 12; + printf("accréditation de 12 points\n"); + } + if (formule == 'B') + { + tabAdherent[i] = tabAdherent[i] + 20; + printf("accréditation de 20 points\n"); + } + } + if (trouve == 0) + printf("Erreur ! Numéro de carte absente de la base de donnée\n"); +} + + + + + + + + + +