From e37e91d0498aebc352bd13719d81c8eb58fddc05 Mon Sep 17 00:00:00 2001 From: Roxane ROSSETTO Date: Fri, 11 Nov 2022 21:00:18 +0100 Subject: [PATCH] Modification de la fonction suppression, changement etat carte --- commun.c | 35 +++++++++++++++++++++++------------ donneeClient.don | Bin 124 -> 133 bytes hCommun.h | 2 +- x.don | 3 ++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/commun.c b/commun.c index 2050fe5..ced65ad 100644 --- a/commun.c +++ b/commun.c @@ -217,7 +217,7 @@ void Recharge(int *tptsbought, int place, char *tcateg) topay = dizpts * 2; tptsbought[place] += nbpts; - printf("Vous avez désormais %d points sur la carte, vous nous devez %d\n", tptsbought[place], topay); + printf("Vous avez désormais %d points sur la carte, vous nous devez %d€\n", tptsbought[place], topay); } if (tcateg[place] == 'S') @@ -226,7 +226,7 @@ void Recharge(int *tptsbought, int place, char *tcateg) topay = dizpts * 4; tptsbought[place] += nbpts; - printf("Vous avez désormais %d points sur la carte, vous nous devez %d\n", tptsbought[place], topay); + printf("Vous avez désormais %d points sur la carte, vous nous devez %d€\n", tptsbought[place], topay); } if (tcateg[place] == 'A') @@ -235,7 +235,7 @@ void Recharge(int *tptsbought, int place, char *tcateg) topay = dizpts * 6; tptsbought[place] += nbpts; - printf("Vous avez désormais %d points sur la carte, vous nous devez %d\n", tptsbought[place], topay); + printf("Vous avez désormais %d points sur la carte, vous nous devez %d€\n", tptsbought[place], topay); } } @@ -682,6 +682,9 @@ void suppr1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *t } } } + else if( contsuppr == 'N' ) + Index(n, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); + } Save(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500, 0); } @@ -757,7 +760,7 @@ void Index(int *n, int *tAd, char tnom[][15], char tpnom[][15], int *tage, int * */ if (choix == 1) { - creationCompte(&VSUIVANTE, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, *n, 500); + creationCompte(&VSUIVANTE, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, n, 500); } if (choix == 2) @@ -787,12 +790,12 @@ void Index(int *n, int *tAd, char tnom[][15], char tpnom[][15], int *tage, int * } } -void creationCompte(int *VSUIVANTE, int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int tmax) +void creationCompte(int *VSUIVANTE, int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int *n, int tmax) { char nom[15], prenom[20], categorie, gen, retour; int age, nclient; FILE *fe, *fx, *fn; - fe= fopen("donneClient.don", "a"); + fe= fopen("donneeClient.don", "a"); fx= fopen("x.don","a"); @@ -826,16 +829,16 @@ void creationCompte(int *VSUIVANTE, int *tAd, char tnom[][15], char tpnom[][15], fprintf(fe,"%c",categorie); *VSUIVANTE=*VSUIVANTE+1; - + *n = *n+1; fprintf(fx,"\n%d",*VSUIVANTE); printf("Ajoutez un contact?(O/N)\n"); scanf("%c%*c", &retour); if (retour == 'O') - creationCompte(VSUIVANTE, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500, n); + creationCompte(VSUIVANTE, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, n, 500); else - Index(&n, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); + Index(n, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); } @@ -873,7 +876,9 @@ void menuAff (int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstat void changementEtatCarte ( int nclient ,int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int tmax, int n) { int nchoix, coderet, pos; - + fRecherche(tAd, n, nclient, &coderet, &pos); + if(coderet == 1) + { printf("\nNouvel état de la carte:"); printf("\nDésactiver(0)"); @@ -883,17 +888,23 @@ void changementEtatCarte ( int nclient ,int *tAd, char tnom[][15], char tpnom[][ if (nchoix == 0) { - fRecherche(tAd, n, nclient, &coderet, &pos); + //fRecherche(tAd, n,nclient, &coderet, &pos); tstate[pos]= 0; Index(&n, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); } if (nchoix == 1) { - fRecherche(tAd, n, nclient, &coderet, &pos); + //fRecherche(tAd, n, nclient, &coderet, &pos); tstate[pos]= 1; Index(&n, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); } } + else + { + printf("Client inconnu!"); + Index(&n, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); + } + } diff --git a/donneeClient.don b/donneeClient.don index f401868adf8731e7bef843f0e932318a1042fe40..842de3f2db683c0c597fe6bf0d267ddc2ccf7fec 100644 GIT binary patch delta 54 qcmbhlte~Lal$o57T2hkAX==)8z-bJ`h9IUh02a9l#sB~S diff --git a/hCommun.h b/hCommun.h index 561ab6f..75450de 100644 --- a/hCommun.h +++ b/hCommun.h @@ -8,7 +8,7 @@ void cptAct(int *bad, int *muscu, int *foot, int *squa, int * zumba, int chx); void affNbParAct(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int tmax); void suppr1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int *n, int tmax); char Card(void);//check si le client a la carte -void creationCompte(int *VSUIVANTE,int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int tmax); +void creationCompte(int *VSUIVANTE,int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int *n, int tmax); void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang); void Name( char *nom, char *prenom); int FindData(char *nom, char *prenom, char tnom[][15], char tpnom[][15], int *tpasseoupas, int *tptsbought, char *action, int tmax); diff --git a/x.don b/x.don index 7fb2719..d2f39bf 100644 --- a/x.don +++ b/x.don @@ -6,4 +6,5 @@ 4 5 6 -7 \ No newline at end of file +7 +8 \ No newline at end of file