Modification de la fonction suppression, changement etat carte

master
Roxane ROSSETTO 2 years ago
parent 96465a1791
commit e37e91d049

@ -217,7 +217,7 @@ void Recharge(int *tptsbought, int place, char *tcateg)
topay = dizpts * 2; topay = dizpts * 2;
tptsbought[place] += nbpts; 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') if (tcateg[place] == 'S')
@ -226,7 +226,7 @@ void Recharge(int *tptsbought, int place, char *tcateg)
topay = dizpts * 4; topay = dizpts * 4;
tptsbought[place] += nbpts; 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') if (tcateg[place] == 'A')
@ -235,7 +235,7 @@ void Recharge(int *tptsbought, int place, char *tcateg)
topay = dizpts * 6; topay = dizpts * 6;
tptsbought[place] += nbpts; 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); 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) 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) 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; char nom[15], prenom[20], categorie, gen, retour;
int age, nclient; int age, nclient;
FILE *fe, *fx, *fn; FILE *fe, *fx, *fn;
fe= fopen("donneClient.don", "a"); fe= fopen("donneeClient.don", "a");
fx= fopen("x.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); fprintf(fe,"%c",categorie);
*VSUIVANTE=*VSUIVANTE+1; *VSUIVANTE=*VSUIVANTE+1;
*n = *n+1;
fprintf(fx,"\n%d",*VSUIVANTE); fprintf(fx,"\n%d",*VSUIVANTE);
printf("Ajoutez un contact?(O/N)\n"); printf("Ajoutez un contact?(O/N)\n");
scanf("%c%*c", &retour); scanf("%c%*c", &retour);
if (retour == 'O') 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 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) 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; int nchoix, coderet, pos;
fRecherche(tAd, n, nclient, &coderet, &pos);
if(coderet == 1)
{
printf("\nNouvel état de la carte:"); printf("\nNouvel état de la carte:");
printf("\nDésactiver(0)"); printf("\nDésactiver(0)");
@ -883,17 +888,23 @@ void changementEtatCarte ( int nclient ,int *tAd, char tnom[][15], char tpnom[][
if (nchoix == 0) if (nchoix == 0)
{ {
fRecherche(tAd, n, nclient, &coderet, &pos); //fRecherche(tAd, n,nclient, &coderet, &pos);
tstate[pos]= 0; tstate[pos]= 0;
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);
} }
if (nchoix == 1) if (nchoix == 1)
{ {
fRecherche(tAd, n, nclient, &coderet, &pos); //fRecherche(tAd, n, nclient, &coderet, &pos);
tstate[pos]= 1; tstate[pos]= 1;
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);
} }
} }
else
{
printf("Client inconnu!");
Index(&n, tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500);
}
}

Binary file not shown.

@ -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 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); 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 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 fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang);
void Name( char *nom, char *prenom); 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); int FindData(char *nom, char *prenom, char tnom[][15], char tpnom[][15], int *tpasseoupas, int *tptsbought, char *action, int tmax);

@ -7,3 +7,4 @@
5 5
6 6
7 7
8
Loading…
Cancel
Save