diff --git a/commun.c b/commun.c index ac6b131..a110713 100644 --- a/commun.c +++ b/commun.c @@ -105,7 +105,6 @@ void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, i { int i, coderet, rang, trouve, NonTrouve; - fRecherche(tAd, n, noClient, &coderet, &rang); trouve = coderet; @@ -206,9 +205,81 @@ void affNbParAct(int *tacti, int tlog) printf("Le nombre d'entrée par activité est de\n"); printf("Badminton\t Musculation\t Foot\t Squash\t Zumba\n"); printf("%d\t %d\t %d\t %d\t %d\t", totbad, totmuscu, totfoot, totsqua, totzumba); +} + + +//Fonction suppression d'un client + +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) +{ + int coderet, rang, noClient, i; + char contsuppr, confsupp; + + printf("Entrez le numero client à supprimer"); + scanf("%d", &noClient); + + fRecherche(tAd, n, noClient, &coderet, &rang); + if ( coderet == 1 ) + { + printf("Confirmation de la suppression? O/N"); + scanf("%*c%c%*c", &confsupp) + if ( confsupp == 'O') + { + for ( i = rang ; i < n-1 ; i++) + + tAd[i] = tAd[i+1]; + tnom[i] = tnom[i+1]; + tpnom[i] = tpnom[i+1]; + tage[i] = tage[i+1]; + tstate[i] = tstate[i+1]; + tacti[i] = tacti[i+1]; + tpasseoupas[i] = tpasseoupas[i+1]; + tptsbought[i] = tptsbought[i+1]; + tptsbonus[i] = tptsbonus[i+1]; + tcateg[i] = tcateg[i+1]; + + printf("Le client numéro %d a été supprimé", noClient); + return; + } } + while ( coderet == 0 ) + { + { + printf("Le numéro client n'est pas trouvé. Voulez-vous continuez? O/N"); + scanf("%*c%c%*c", &confsuppr); + } + if( contsuppr == 'O') + { + printf("Veuillez entrer a nouveau le numéro de carte à supprimer"); + scanf("%d", &noClient); + fRecherche(tAd, n, noClient, &coderet, &rang); + + if ( coderet == 1 ) + { + printf("Confirmation de la suppression? O/N"); + scanf("%*c%c%*c", &confsupp) + if ( confsupp == 'O') + { + for ( i = rang ; i < n-1 ; i++) + + tAd[i] = tAd[i+1]; + tnom[i] = tnom[i+1]; + tpnom[i] = tpnom[i+1]; + tage[i] = tage[i+1]; + tstate[i] = tstate[i+1]; + tacti[i] = tacti[i+1]; + tpasseoupas[i] = tpasseoupas[i+1]; + tptsbought[i] = tptsbought[i+1]; + tptsbonus[i] = tptsbonus[i+1]; + tcateg[i] = tcateg[i+1]; + + printf("Le client numéro %d a été supprimé", noClient); + return;} + } + } +} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //EVANN \ No newline at end of file diff --git a/hCommun.h b/hCommun.h index 80fe6be..70cfd3f 100644 --- a/hCommun.h +++ b/hCommun.h @@ -1,10 +1,13 @@ // .h Roxane -int fchargement(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, int *tCActiv, int *tActivite, int *tPasseouPas,int *tPtsBought, int *tPtsBonus, char *tCat, int tmax); void fRecherche(int *tNoClient, int n, int noClient, int *coderet, int *rang); void fAffichage1Client(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient ); int afficheTous(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient ) +int affNbmEntree( int *tpasseoupas, int tlog) +void cptAct(int *bad, int *muscu, int *foot, int *squa, int * zumba, int chx) +void affNbParAct(int *tacti, int tlog) +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) //.h Lo int Fillvar(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int tmax);