From 4d7cfe6cfacb7f3d5e732447d4630f5d63c9ad08 Mon Sep 17 00:00:00 2001 From: Evann ABRIAL Date: Thu, 10 Nov 2022 10:52:17 +0100 Subject: [PATCH 01/13] Fonction evann --- evsae.c | 317 ++++++++++++++++++++++++++++++++-------------------- evsae.h | 4 +- evtestsae.c | 9 ++ test | Bin 17024 -> 17136 bytes x.don | 10 +- 5 files changed, 214 insertions(+), 126 deletions(-) create mode 100644 evtestsae.c diff --git a/evsae.c b/evsae.c index bd5c78e..7946af4 100644 --- a/evsae.c +++ b/evsae.c @@ -1,122 +1,195 @@ -#include -#include "sae.h" -#include - -void menu (void) - { - char choix, retourmenu; - int VSUIVANTE; - FILE *fx; - - fx=fopen("x.don","r"); - if (fx==NULL) - {printf("erreur"); - return;} - - - while(feof(fx)) - { - fscanf(fx,"%d",&VSUIVANTE); - } - - printf("\nQue souhaitez vous faire?\n"); - printf("\n1- Créer un compte\n"); - printf("2- Presenter sa carte\n"); - printf("\nTapez h pour une aide\n"); - scanf("%c%*c", &choix); - - if (choix == 'h') - { - printf("\n\tBienvenue dans notre application!\n"); - printf("\nVous êtes arrivées dans le menu de notre incroyable salle de sport\n"); - printf("Tapez le nombre au début de la liste des fonctionnalitées pour y accéder"); - printf("\nSi vous êtes nouveau, nous vous conseillons de créer un compte en tapant 1 dan le menu"); - printf("\nTapez O pour retourner au menu principal\n"); - scanf("%c%*c",&retourmenu); - - if (retourmenu == 'O') - - menu(); - } - - if (choix == '1') - { - creationCompte( &VSUIVANTE); - } - - if (choix == '2') - { - printf("gogogogo"); - //Compte() - } - } - -void c(void) - { - int x=10000000, i=0; - FILE *fe; - fe = fopen("nclient.don","w"); - - for (i=0; i +#include "evsae.h" +#include + +void menu (void) + { + char choix, retourmenu; + int VSUIVANTE, next; + FILE *fx; + + fx=fopen("x.don","r"); + + if (fx==NULL) + {printf("erreur"); + return;} + + VSUIVANTE=0; + + while(!feof(fx)) + { + fscanf(fx, "%d", &next); + + if ( next> VSUIVANTE) + { + VSUIVANTE=next; + } + } + + printf("\nQue souhaitez vous faire?\n"); + printf("\n1- Créer un compte\n"); + printf("2- Presenter sa carte\n"); + printf("Controle C pour quitter"); + printf("\nTapez h pour une aide\n"); + + scanf("%*c%c%*c", &choix); + + while ( choix != 'h' && choix != '1' && choix != '2') + { + printf("\nEntrez soit h, soit 1, soit 2.\t"); + scanf("%c", &choix); + } + + if (choix == 'h') + { + printf("\n\tBienvenue dans notre application!\n"); + printf("\nVous êtes arrivées dans le menu de notre incroyable salle de sport\n"); + printf("Tapez le nombre au début de la liste des fonctionnalitées pour y accéder"); + printf("\nSi vous êtes nouveau, nous vous conseillons de créer un compte en tapant 1 dan le menu"); + printf("\nTapez O pour retourner au menu principal\n"); + scanf("%c",&retourmenu); + + while ( retourmenu != 'O') + { + printf("\nTapez la lettre O pour revenir au menu.\t"); + scanf("%*c%c%*c", &retourmenu); + } + + if (retourmenu == 'O') + menu(); + + } + + if (choix == '1') + { + creationCompte( &VSUIVANTE); + } + + if (choix == '2') + { + printf("gogogogo"); + //Compte() + } + + } + + +/* +void c(void) + { + int x=10000000, i=0; + FILE *fe; + fe = fopen("nclient.don","w"); + + for (i=0; i noClient) + + *rang = i; + + return; + + } + +} +void changementEtatCarte ( int *tAd , int *tstate) + { + int nchoix + + printf("\nNouvel état de la carte:"); + + printf("\nDésactiver(0)") + printf("\nActiver(1)") + + scanf("%c%*c",&nchoix + + if (nchoix == 'D') + { + printf("\Mauvais comportement(M)") + + printf("\Carte perdu(P)") + } + + + + + + + + + diff --git a/evsae.h b/evsae.h index dc5d167..554413a 100644 --- a/evsae.h +++ b/evsae.h @@ -1,4 +1,4 @@ #include -void menu (void); +void menu (); void creationCompte(int *VSUIVANTE); -void c(void); +void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang); diff --git a/evtestsae.c b/evtestsae.c new file mode 100644 index 0000000..958d8af --- /dev/null +++ b/evtestsae.c @@ -0,0 +1,9 @@ +#include +#include "evsae.h" + +int main (void) + { + //c(); + menu(); + return 0; + } diff --git a/test b/test index fb9a7570798dbd2f3bc2eab4c3d2a1265622daae..18e61ce9314ac6f565312d77d4d5ca1a85e1911d 100755 GIT binary patch delta 3590 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 NAt2qVgNqFt{s;BnS7!hK diff --git a/x.don b/x.don index 7fdf52a..708a8d5 100644 --- a/x.don +++ b/x.don @@ -1,2 +1,8 @@ -0 --2091757392-2091757392-2085961056 \ No newline at end of file +0 +1 +1 +2 +3 +4 +5 +6 \ No newline at end of file From 08714f085309d9eaf0ffbf185349e5ae2214a9b1 Mon Sep 17 00:00:00 2001 From: Roxane ROSSETTO Date: Thu, 10 Nov 2022 10:58:20 +0100 Subject: [PATCH 02/13] Modification des fonctions Roxane --- commun.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- hCommun.h | 5 +++- 2 files changed, 76 insertions(+), 2 deletions(-) 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); From 35473f298d7ac8e9214029768eddcdd86ab3d189 Mon Sep 17 00:00:00 2001 From: Lola CHALMIN Date: Thu, 10 Nov 2022 13:32:35 +0100 Subject: [PATCH 03/13] les vrais --- sae.c | 323 ++++++++++++++++++ sae.h | 13 + saelo.c | 72 ---- saelo.h | 4 - testsaelo.c | 946 ---------------------------------------------------- tsae.c | 96 ++++++ 6 files changed, 432 insertions(+), 1022 deletions(-) create mode 100644 sae.c create mode 100644 sae.h delete mode 100644 saelo.c delete mode 100644 saelo.h delete mode 100644 testsaelo.c create mode 100644 tsae.c diff --git a/sae.c b/sae.c new file mode 100644 index 0000000..88d0f79 --- /dev/null +++ b/sae.c @@ -0,0 +1,323 @@ +#include "sae.h" +#include +#include + + +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)//lis le fichier et met les valeurs dans les tableaux +{ + FILE *f; + f = fopen("donneeClient.don", "r"); + if (f == NULL) + { + printf("Problème d'ouverture du fichier Clients..."); + return -1; + } + int i = 0; + int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; + char categ, fnom[15], fprenom[15]; + + fscanf(f, "%d", &numAd); + fscanf(f, "%*c%s", fnom); + fscanf(f, "%*c%s", fprenom); + fscanf(f, "%*c%d", &age); + fscanf(f, "%*c%d", &state); + fscanf(f, "%*c%d", &acti); + fscanf(f, "%*c%d", &passeoupas); + fscanf(f, "%*c%d", &ptsbought); + fscanf(f, "%*c%d%*c", &ptsbonus); + fscanf(f, "%*c%c", &categ); + + while (!feof(f)) + { + if (i == tmax) + { + printf("Problème de gestion: trop de clients enregistrés à ce jour"); + return -1; + } + + + tAd[i] = numAd; + strcpy(tnom[i], fnom); + strcpy(tpnom[i], fprenom); + tage[i] = age; + tstate[i] = state; + tacti[i] = acti; + tpasseoupas[i] = passeoupas; + tptsbought[i] = ptsbought; + tptsbonus[i] = ptsbonus; + tcateg[i] = categ; + + i++; + + fscanf(f, "%d", &numAd); + fscanf(f, "%*c%s", fnom); + fscanf(f, "%*c%s", fprenom); + fscanf(f, "%*c%d", &age); + fscanf(f, "%*c%d", &state); + fscanf(f, "%*c%d", &acti); + fscanf(f, "%*c%d", &passeoupas); + fscanf(f, "%*c%d", &ptsbought); + fscanf(f, "%*c%d%*c", &ptsbonus); + fscanf(f, "%*c%c", &categ); + + } + fclose(f); + return 0; +} + + + +char Card(void)//demande si client a la carte +{ + char bCard; + printf("Avez-vous votre numéro de carte adhérent avec vous ?(O/N)\n"); + scanf("%c", &bCard); + return bCard; +} + + + +void Name( char *nom, char *prenom)//demande nom et prénom +{ + printf("Dans ce cas, quel est votre nom ?\n"); + scanf("%s", nom); + + printf("Et votre prénom ?\n"); + scanf("%s", prenom); +} + + + + +int FindData(char *nom, char *pnom, char tnom[][15], char tpnom[][15], int *tpasseoupas, int *tptsbought, char *action, int tmax) +{ + int i, found = 0, testnom, testpnom; + i = 0; + testnom = strcmp(tnom[i], nom);//comparer nom du fichier et nom donné + testpnom = strcmp(tpnom[i], pnom);//comparer prénom du fichier et prénom donné + while (found == 0 && i < tmax) + { + if (testnom == 0) + { + if (testpnom == 0) + found = 1; + break; + } + i++; + testnom = strcmp(tnom[i], nom); + testpnom = strcmp(tpnom[i], pnom); + } + + if (found == 0) + { + printf("Recherche non aboutie : numéro non enregistré...\n");//si le client n'est au final pas enregistré + return -1; + } + + if (found == 1)//si trouvé + { + if (tpasseoupas[i] == 1)//si client déjà passé + { + printf("Déjà passé, nombre possible de passage dans une journée : 1...\n"); + return -1; + } + printf("Carte trouvée !\n"); + return i; + } +} + + + +int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax) +{ + int i, found = 0; + i = 0; + while (found == 0 && i < tmax) + { + if(tAd[i] == numAd) + { + break; + } + i++; + } + + if (found == 0) + { + printf("Recherche non aboutie : numéro non enregistré...\n");//si le client n'est au final pas enregistré + return -1; + } + + if (found == 1)//si trouvé + { + if (tpasseoupas[i] == 1)//si client déjà passé + { + printf("Déjà passé, nombre possible de passage dans une journée : 1...\n"); + return -1; + } + printf("Carte trouvée !\n"); + return i; + } +} + + +void Recharge(int *tptsbought, int place, char *tcateg) +{ + int dizpts, topay, nbpts; + printf("Combien de dizaines de points souhaitez-vous acheter ?\n"); + scanf("%d", &dizpts); + while (dizpts > 100 || dizpts < 0) + { + printf("Veuillez entrer un nombre correct de dizaines de points\n"); + scanf("%d", &dizpts); + } + + if (tcateg[place] == 'E') + { + nbpts = dizpts * 10; + topay = dizpts * 2; + tptsbought[place] += nbpts; + + printf("Vous avez désormais %d points sur la carte, vous nous devez %d\n", tptsbought[place], topay); + } + + if (tcateg[place] == 'S') + { + nbpts = dizpts * 10; + topay = dizpts * 4; + tptsbought[place] += nbpts; + + printf("Vous avez désormais %d points sur la carte, vous nous devez %d\n", tptsbought[place], topay); + } + + if (tcateg[place] == 'A') + { + nbpts = dizpts * 10; + topay = dizpts * 6; + tptsbought[place] += nbpts; + + printf("Vous avez désormais %d points sur la carte, vous nous devez %d\n", tptsbought[place], topay); + } + +} + + + +int Acti(int i) +{ + int acti; + printf("Choix de l'activité %d: badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5) \n", i); + scanf("%*c%d", &acti); + while (acti != 1 && acti != 2 && acti != 3 && acti != 4 && acti != 5) + { + printf("Veuillez entrer un nombre d'activité correct (badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5))\n"); + scanf("%d%*c", &acti); + } + return acti; +} + + + +int ChoiceActi(int nbacti, int *tacti) +{ + int chxacti, chx1, chx2, chx3; + + if (nbacti == 1) + { + chxacti = Acti(nbacti); + } + + + if (nbacti == 2) + { + chx1 = Acti(nbacti-1); + chx2 = Acti(nbacti); + chxacti = chx1 + chx2*10 ; + + } + else + { + chx1 = Acti(nbacti-2); + chx2 = Acti(nbacti-1); + chx3 = Acti(nbacti); + chxacti = chx1 + chx2*10 + chx3*100; + } + return chxacti; +} + + + +void ChoiceMenu(char *choix) +{ + printf("Recharge carte (R) | Afficher points (A) | Choix activités (C) | Quitter (Q)\n"); + scanf("%*c%c%*c", choix); + while (*choix != 'R' && *choix != 'A' && *choix != 'C' && *choix != 'Q') + { + printf("Entrer un caractère correct R | A | C | Q \n"); + scanf("%c%*c", choix); + } +} + + +void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int acti) +{ + int u , d, c, actu, actd, actc, ptsneeded; + char confirm; + u = acti % 10;//acti1 + d = (acti-u) / 10 ;//acti2 + c = acti / 100;//acti3 + actu = CheckActi(u); + printf + actd = CheckActi(d); + actc = CheckActi(c); + ptsneeded = actu + actd + actc; + printf("%d", ptsneeded); + + if (ptsneeded <= tptsbought[place]) + { + ("Points suffisants, confirmation ? (O/N) \n"); + scanf("%*c%c%*c", &confirm); + if (confirm == 'O') + { + tptsbought[place] -= ptsneeded; + tptsbonus[place] += ptsneeded; + if (tptsbonus[place] >= 100) + { + tptsbought[place] += 15; + tptsbonus[place] -= 100; + } + } + } + else + { + printf("J'y vais pas"); + } +} + +int CheckActi(int nb) +{ + if (nb == 1)//badminton + { + return 8; + } + + if (nb == 2)//football + { + return 5; + } + + if (nb == 3)//zumba + { + return 5; + } + + if (nb == 4)//muscu + { + return 15; + } + + if (nb == 5)//squash + { + return 10; + } +} + diff --git a/sae.h b/sae.h new file mode 100644 index 0000000..553c944 --- /dev/null +++ b/sae.h @@ -0,0 +1,13 @@ +#define TAILLE 500 + +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); +char Card(void); +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); +void Recharge(int *tptsbought, int place, char *tcateg); +int ChoiceActi(int nbacti, int *tacti); +int Acti(int i); +void ChoiceMenu(char *choix); +int CheckActi(int nb); +int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); +void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int acti); \ No newline at end of file diff --git a/saelo.c b/saelo.c deleted file mode 100644 index b5e32eb..0000000 --- a/saelo.c +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include "saelo.h" - -char Card(void)//demande si client a la carte -{ - char bCard; - printf("Avez-vous votre numéro de carte adhérent avec vous ?(O/N)\n"); - scanf("%c", &bCard); - return bCard; -} - - - -void Name( char *nom, char *prenom)//demande nom et prénom -{ - printf("Dans ce cas, quel est votre nom ?\n"); - scanf("%s%*c", nom); - printf("Et votre prénom ?\n"); - scanf("%s%*c", prenom); -} - - - -int Fillvar(FILE *f, int *numAd, char *fnom, char *fprenom, int *age, int *state, int *acti, int *passeoupas, int *ptsbought, int *ptsbonus, char *categ)//lis le fichier et met les valeurs dans les variables -{ - if (feof(f)) - { - return -1; - } - fscanf(f, "%6d\n", numAd); - fscanf(f, "%s", fnom); - fscanf(f, "%s", fprenom); - fscanf(f, "%2d", age); - fscanf(f, "%d", state); - fscanf(f, "%d", acti); - fscanf(f, "%d", passeoupas); - fscanf(f, "%2d", ptsbought); - fscanf(f, "%2d%*c", ptsbonus); - fscanf(f, "%c", categ); -} - -/* -void ifnoCard(int *testnom, int *testpnom, int *erreur, char *fnom, char *fprenom, char *nom, char *prenom, FILE *f, int numAd, int age, int state, int acti, int passeoupas, int ptsbought, int ptsbonus, char categ) -{ - - puts("Recherche de la carte !"); - - testnom = strcmp(fnom, nom);//comparer nom du fichier et nom donné - testpnom = strcmp(fprenom, prenom);//comparer prénom du fichier et prénom donné - - - - - while (testnom!=0 && testpnom!=0 && erreur != -1)// tant que les 2 différents - { - erreur = Fillvar(f, &numAd, fnom, fprenom, &age, &state, &acti, &passeoupas, &ptsbought, &ptsbonus, &categ);//rescan - - testnom = strcmp(fnom, nom);//recomparaison nom - testpnom = strcmp(fprenom, prenom);//recomparaison prénom - } - - if(erreur == -1) - { - printf("Recherche non aboutie : numéro non enregistré...\n");//si le client n'est au final pas enregistré - return; - } -} -*/ - - diff --git a/saelo.h b/saelo.h deleted file mode 100644 index c26c56b..0000000 --- a/saelo.h +++ /dev/null @@ -1,4 +0,0 @@ -void Name( char *nom, char *prenom); -char Card(void); -int Fillvar(FILE *f, int *numAd, char *fnom, char *fprenom, int *age, int *state, int *acti, int *passeoupas, int *ptsbought, int *ptsbonus, char *categ); -void ifnoCard(int *testnom, int *testpnom, int *erreur, char *fnom, char *fprenom, char *nom, char *prenom, FILE *f, int *numAd, int age, int state, int acti, int passeoupas, int ptsbought, int ptsbonus, char categ); diff --git a/testsaelo.c b/testsaelo.c deleted file mode 100644 index a9a4af7..0000000 --- a/testsaelo.c +++ /dev/null @@ -1,946 +0,0 @@ -#include -#include -#include "saelo.h" - -void main(void) -{ - char nom[15], prenom[15], fnom[15], fprenom[15], bCard, member, categ, recharge, acti1[15], acti2[15], acti3[15]; - int erreur, numAd, age, state, acti, passeoupas, ptsbought,ptsbonus, numCard, avoiravecevann, testnom, testpnom, found = 0, ptrecharge, nbacti, numacti, s1, s2, s3, m1, m2, m3, f1, f2, f3, b1, b2, b3, z1, z2, z3; - - FILE *f; - f = fopen("donneeClient.don","r"); - if (f==NULL){printf("Erreur ouverture fichier clients"); fclose(f); return;} - - - - - //accueil - printf("Bienvenue ! Déjà membre ou création de compte ? Créer (C) ou Membre (M)\n"); - scanf("%c%*c", &member); - bCard = Card(); - erreur = Fillvar(f, &numAd, fnom, fprenom, &age, &state, &acti, &passeoupas, &ptsbought, &ptsbonus, &categ); - - - - - //si nouveau client / créer nouveau compte - if (member == 'C') - { - /*creationCompte(int avoiravecevann);*/ - avoiravecevann = 2; - } - - - - - //demander nom & prénom - Name(nom, prenom); - - - //si client n'a pas son numéro de carte - if (bCard == 'N') - { - - puts("Recherche de la carte !"); - - testnom = strcmp(fnom, nom);//comparer nom du fichier et nom donné - testpnom = strcmp(fprenom, prenom);//comparer prénom du fichier et prénom donné - - - while (erreur != -1 && found == 0)// tant que pas d'erreur ou pas trouvé - { - if (testnom == 0) - { - if (testpnom == 0) - found = 1; - break; - } - - erreur = Fillvar(f, &numAd, fnom, fprenom, &age, &state, &acti, &passeoupas, &ptsbought, &ptsbonus, &categ);//rescan - testnom = strcmp(fnom, nom);//recomparaison nom - testpnom = strcmp(fprenom, prenom);//recomparaison prénom - } - - if(erreur == -1 || found == 0)//si pas trouvé ou fin de fichier - { - printf("Recherche non aboutie : numéro non enregistré...\n");//si le client n'est au final pas enregistré - return; - } - - - - if (found == 1)//si trouvé - { - if (passeoupas == 1)//si client déjà passé - { - printf("Déjà passé, nombre possible de passage dans une journée : 1...\n"); - return; - } - printf("La carte dispose de %d points, rechargement de carte souhaité ? (O/N) \n", ptsbought);//infos sur ses points + recharge ? - scanf("%c%*c", &recharge); - - - if (recharge == 'O')//si client souhaite recharger carte - { - printf("De combien de dizaine de points souhaitez vous recharger ?\n"); - scanf("%d%*c", &ptrecharge); - printf("%d", ptrecharge); - } - } - } - - - - - if (bCard == 'O')//si client a la carte - { - printf("Veuillez entrer numéro de carte ?\n"); - scanf("%d%*c", &numCard); - while (numCard < 100000 || numCard > 999999)//vérifier numéro carte correct (6 chiffres) - { - printf("Veuillez saisir un numéro de carte correct\n"); - scanf("%d%*c", &numCard); - } - - - erreur = Fillvar(f, &numAd, fnom, fprenom, &age, &state, &acti, &passeoupas, &ptsbought, &ptsbonus, &categ);//scanner le document et récupérer les variables - - while (numCard != numAd && erreur == 0)//tant que numéro de carte donné différent de celui du fichier - { - erreur = Fillvar(f, &numAd, fnom, fprenom, &age, &state, &acti, &passeoupas, &ptsbought, &ptsbonus, &categ);//rescan - } - - if (passeoupas == 1) - { - printf("Déjà passé, nombre possible de passage dans une journée : 1..."); - return; - } - - printf("La carte dispose de %d points, rechargement de carte souhaité ? (O/N) \n", ptsbought);//nombre de points qu'il a + recharger ou non - scanf("%c", &recharge); - - } - - printf("Combien d'activités souhaitées aujourd'hui ? (max 3)\n"); - scanf("%d%*c", &nbacti); - while (nbacti > 3 || nbacti <= 0) - { - printf("Nombre d'activités incorrect, veuillez re-saisir (max 3)\n"); - scanf("%d%*c", &nbacti); - } - - - //si il n'y a qu'un activité - if (nbacti == 1) - { - printf("Quelle est-elle ?(zumba/badminton/musculation/football/squash)\n"); - scanf("%s", acti1); - z1 = strcmp(acti1, "zumba"); - b1 = strcmp(acti1, "badminton"); - printf("%d", b1); - m1 = strcmp(acti1, "musculation"); - s1 = strcmp(acti1, "squash"); - f1 = strcmp(acti1, "football"); - while(z1 != 0 && b1 != 0 && m1 != 0 && s1 != 0 && f1 != 0) - { - printf("Veuillez saisir une activité correcte \n"); - scanf("%s", acti1); - } - if (z1 == 0) - { - numacti = 5; - if (ptsbought < 5) - { - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (b1 == 0) - { - numacti = 1; - if (ptsbought < 8) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 8; - ptsbonus += 8; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (s1 == 0) - { - numacti = 4; - if (ptsbought < 10) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 10; - ptsbonus += 10; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (f1 == 0) - { - numacti = 3; - if (ptsbought < 5) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (m1 == 0) - { - numacti = 2; - if (ptsbought < 15) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 15; - ptsbonus += 15; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - } - - - //si il y a 2 activités - if (nbacti == 2) - { - printf("Quelles sont-elles ?(zumba/badminton/musculation/football/squash)\n"); - scanf("%s%*c", acti1); - scanf("%s%*c", acti2); - z1 = strcmp(acti1, "zumba"); - b1 = strcmp(acti1, "badminton"); - m1 = strcmp(acti1, "musculation"); - s1 = strcmp(acti1, "squash"); - f1 = strcmp(acti1, "football"); - while(z1 != 0 && b1 != 0 && m1 != 0 && s1 != 0 && f1 != 0) - { - printf("Veuillez saisir une activité correcte \n"); - scanf("%s", acti1); - } - z2 = strcmp(acti2, "zumba"); - b2 = strcmp(acti2, "badminton"); - m2 = strcmp(acti2, "musculation"); - s2 = strcmp(acti2, "squash"); - f2 = strcmp(acti2, "football"); - while(z2 != 0 && b2 != 0 && m2 != 0 && s2 != 0 && f2 != 0) - { - printf("Veuillez saisir une activité correcte \n"); - scanf("%s", acti2); - } - - - //première activité - if (z1 == 0) - { - numacti = 5; - if (ptsbought < 5) - { - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (b1 == 0) - { - numacti = 1; - if (ptsbought < 8) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 8; - ptsbonus += 8; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (s1 == 0) - { - numacti = 4; - if (ptsbought < 10) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 10; - ptsbonus += 10; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (f1 == 0) - { - numacti = 3; - if (ptsbought < 5) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (m1 == 0) - { - numacti = 2; - if (ptsbought < 15) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 15; - ptsbonus += 15; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - - - - - //deuxième activité - if (z2 == 0) - { - numacti += 5*10; - if (ptsbought < 5) - { - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (b2 == 0) - { - numacti += 1*10; - if (ptsbought < 8) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 8; - ptsbonus += 8; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (s2 == 0) - { - numacti += 4*10; - if (ptsbought < 10) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 10; - ptsbonus += 10; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (f2 == 0) - { - numacti += 3*10; - if (ptsbought < 5) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (m2 == 0) - { - numacti += 2*10; - if (ptsbought < 15) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 15; - ptsbonus += 15; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - } - - - - - - if (nbacti == 3) - { - printf("Quelles sont-elles ?(zumba/badminton/musculation/football/squash)\n"); - scanf("%s", acti1); - scanf("%s", acti2); - scanf("%s", acti3); - z1 = strcmp(acti1, "zumba"); - b1 = strcmp(acti1, "badminton"); - m1 = strcmp(acti1, "musculation"); - s1 = strcmp(acti1, "squash"); - f1 = strcmp(acti1, "football"); - while(z1 != 0 && b1 != 0 && m1 != 0 && s1 != 0 && f1 != 0) - { - printf("Veuillez saisir une activité correcte \n"); - scanf("%s", acti1); - } - z2 = strcmp(acti2, "zumba"); - b2 = strcmp(acti2, "badminton"); - m2 = strcmp(acti2, "musculation"); - s2 = strcmp(acti2, "squash"); - f2 = strcmp(acti2, "football"); - while(z2 != 0 && b2 != 0 && m2 != 0 && s2 != 0 && f2 != 0) - { - printf("Veuillez saisir une activité correcte \n"); - scanf("%s", acti2); - } - z3 = strcmp(acti3, "zumba"); - b3 = strcmp(acti3, "badminton"); - m3 = strcmp(acti3, "musculation"); - s3 = strcmp(acti3, "squash"); - f3 = strcmp(acti3, "football"); - while(z3 != 0 && b3 != 0 && m3 != 0 && s3 != 0 && f3 != 0) - { - printf("Veuillez saisir une activité correcte \n"); - scanf("%s", acti3); - } - - //première activité - if (z1 == 0) - { - numacti = 5; - if (ptsbought < 5) - { - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (b1 == 0) - { - numacti = 1; - if (ptsbought < 8) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 8; - ptsbonus += 8; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (s1 == 0) - { - numacti = 4; - if (ptsbought < 10) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 10; - ptsbonus += 10; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (f1 == 0) - { - numacti = 3; - if (ptsbought < 5) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (m1 == 0) - { - numacti = 2; - if (ptsbought < 15) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 15; - ptsbonus += 15; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - - - - printf("%d", numacti); - //deuxième activité - if (z2 == 0) - { - numacti += 5*10; - if (ptsbought < 5) - { - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (b2 == 0) - { - numacti += 1*10; - if (ptsbought < 8) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 8; - ptsbonus += 8; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (s2 == 0) - { - numacti += 4*10; - if (ptsbought < 10) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 10; - ptsbonus += 10; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (f2 == 0) - { - numacti += 3*10; - if (ptsbought < 5) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (m2 == 0) - { - numacti += 2*10; - if (ptsbought < 15) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 15; - ptsbonus += 15; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - - printf("%d", numacti); - //troisième activité - if (z3 == 0) - { - numacti += 5*100; - if (ptsbought < 5) - { - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (b3 == 0) - { - numacti += 1*100; - if (ptsbought < 8) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 8; - ptsbonus += 8; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (s3 == 0) - { - numacti += 4*100; - if (ptsbought < 10) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 10; - ptsbonus += 10; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (f3 == 0) - { - numacti += 3*100; - if (ptsbought < 5) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 5; - ptsbonus += 5; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - if (m3 == 0) - { - numacti += 2*100; - if (ptsbought < 15) - printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); - scanf("%c%*c", &recharge); - if (recharge == 'N') - { - return; - } - else - { - //RELOAD AND CONTINUE - return; - } - ptsbought -= 15; - ptsbonus += 15; - if (ptsbonus >= 100) - { - ptsbought += 15; - ptsbonus -= 100; - } - } - } - - - printf("%d", numacti); - - return; -} diff --git a/tsae.c b/tsae.c new file mode 100644 index 0000000..a1fa928 --- /dev/null +++ b/tsae.c @@ -0,0 +1,96 @@ +#include "sae.h" +#include +#include + +void main(void) +{ + int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret; + char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix; + Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); + + printf("Bienvenue ! \nMembre (M) | Création compte (C)\n"); + scanf("%c%*c", &member); + while (member != 'M' && member != 'C') + { + printf("Saisir un caractère correct (Membre M ou Création C)\n"); + scanf("%*c%c%*c", &member); + } + + + bCard = Card();//demande si carte avec client ou non + + if (member == 'C')//si il y a besoin de créer un compte + { + //à voir avec evann + return; + } + + if (member == 'M')//si le client est déjà membre + { + if (bCard == 'N')// si client n'a pas la carte + { + Name(nom, pnom); + + puts("Recherche de la carte !"); + + place = FindData(nom, pnom, tnom, tpnom, tpasseoupas, tptsbought, &action, 500); + if (place == -1) + { + return; + } + } + + if (bCard == 'O') + { + printf("Numéro carte : \t"); + scanf("%*c%d", &numAd); + ret = FindN(tAd, numAd, tpasseoupas, 500); + if (ret == -1) + { + main(); + } + } + + ChoiceMenu(&choix); + + if (choix == 'A') + { + printf("La carte dispose de %d points.\n", tptsbought[place]);//infos sur ses points + ChoiceMenu(&choix); + } + + if (choix == 'R') + { + Recharge(tptsbought, place, tcateg); + ChoiceMenu(&choix); + } + + if (choix == 'C') + { + printf("Nombre d'activités souhaitées ? (max 3)\n"); + scanf("%d", &nbacti); + while (nbacti < 0 || nbacti > 3) + { + printf("Nombre d'activités incorrect (max 3)\n"); + scanf("%d", &nbacti); + } + + chxacti = ChoiceActi(nbacti, tacti); + CheckPts(tptsbonus, tptsbought, tpasseoupas, place, chxacti); + + + tacti[place] = chxacti; + + ChoiceMenu(&choix); + + } + + if (choix == 'Q') + { + //menuglobal() + return; + } + + } + + } From 649e8bfcf4df6897caa9d802fed5f27aae95d6e6 Mon Sep 17 00:00:00 2001 From: Roxane ROSSETTO Date: Thu, 10 Nov 2022 13:34:34 +0100 Subject: [PATCH 04/13] reutilisation des fichiers perso pour faire les tests --- fRox.c | 296 +++++++++++++++++++++++++++++++++++++++++++++--------- fRox.h | 18 +++- testrox | Bin 16960 -> 0 bytes testrox.c | 19 ++-- 4 files changed, 274 insertions(+), 59 deletions(-) delete mode 100755 testrox mode change 100644 => 100755 testrox.c diff --git a/fRox.c b/fRox.c index 4491df7..c114172 100644 --- a/fRox.c +++ b/fRox.c @@ -1,73 +1,273 @@ #include #include "fRox.h" +#include +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)//lis le fichier et met les valeurs dans les tableaux +{ + FILE *f; + f = fopen("donneeClient.don", "r"); + if (f == NULL) + { + printf("Problème d'ouverture du fichier Clients..."); + return -1; + } + int i = 0; + int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; + char categ, fnom[15], fprenom[15]; + + fscanf(f, "%6d", &numAd); + fscanf(f, "%s", fnom); + fscanf(f, "%s", fprenom); + fscanf(f, "%2d", &age); + fscanf(f, "%d", &state); + fscanf(f, "%d", &acti); + fscanf(f, "%d", &passeoupas); + fscanf(f, "%2d", &ptsbought); + fscanf(f, "%2d%*c", &ptsbonus); + fscanf(f, "%c", &categ); + + while (!feof(f)) + { + if (i == tmax) + { + printf("Problème de gestion: trop de clients enregistrés à ce jour"); + return -1; + } + + + tAd[i] = numAd; + strcpy(tnom[i], fnom); + strcpy(tpnom[i], fprenom); + tage[i] = age; + tstate[i] = state; + tacti[i] = acti; + tpasseoupas[i] = passeoupas; + tptsbought[i] = ptsbought; + tptsbonus[i] = ptsbonus; + tcateg[i] = categ; + + i++; + + fscanf(f, "%6d", &numAd); + fscanf(f, "%s", fnom); + fscanf(f, "%s", fprenom); + fscanf(f, "%2d", &age); + fscanf(f, "%d", &state); + fscanf(f, "%d", &acti); + fscanf(f, "%d", &passeoupas); + fscanf(f, "%2d", &ptsbought); + fscanf(f, "%2d%*c", &ptsbonus); + fscanf(f, "%c", &categ); + + } + fclose(f); + return i; +} + + + //Fonction recherche, (*coderet = 1 si trouvé, = 0 si pas trouvé.) (*rang = rang a laquel se trouve ou doit se trouver la valeur) -void fRecherche(int *tNoClient, int n, int noClient, int *coderet, int *rang) +void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang) { - int i; - - for(i = 0; i < n; i++) - { - if(tNoClient[i] == noClient) - { - *coderet = 1; - *rang = i; - return; - } - if(tNoClient[i] > noClient) - - *rang = i; - return; - } + int i; + + for(i = 0; i < n; i++) + { + if(tAd[i] == noClient) + { + *coderet = 1; + *rang = i; + return; + } + if(tAd[i] > noClient) + + *rang = i; + return; + } } //Affichage D'UN client avec toutes ses données. -void fAffichage1Client(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient ) +void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int n, int noClient ) { - int i, coderet, rang, trouve, NonTrouve; - - - fRecherche(tNoClient, n, noClient, &coderet, &rang); - - trouve = coderet; - - while (trouve == 0) - { - if(coderet == 0) - { - printf("Le numero client n'a pas été trouvé \n"); - printf("Veuillez entrer a nouveau le N° Client ou taper -1 pour annuler\n"); - scanf("%d", &NonTrouve); - } - if(NonTrouve==-1) - return; - else - fRecherche(tNoClient, n, noClient, &coderet, &rang); - trouve=coderet; - } - printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\n"); - printf("%d\t %c%*c \t %c%*c\t %d\t %c\n", tNoClient[rang], tNomClient[rang], tPreClient[rang], tAge[rang], tStatut[rang]); + int i, coderet, rang, trouve, NonTrouve; + + fRecherche(tAd, n, noClient, &coderet, &rang); + + trouve = coderet; + + while (trouve == 0) + { + if(coderet == 0) + { + printf("Le numero client n'a pas été trouvé \n"); + printf("Veuillez entrer a nouveau le N° Client ou taper -1 pour annuler\n"); + scanf("%d", &NonTrouve); + } + if(NonTrouve==-1) + return; + else + fRecherche(tAd, n, noClient, &coderet, &rang); + trouve=coderet; + } + printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\n"); + printf("%d\t %s \t %S\t %d\t %S\n", tAd[rang], tnom[rang], tpnom[rang], tage[rang], tstate[rang]); } //Affichage plusieurs client avec toutes les données -int afficheTous(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient ) +int afficheTous(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int n, int noClient ) +{ + int i; + printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\n"); + for (int i = 0; i < n; ++i) + { + printf("%d\t %s\t %s\t %d\t %s\n", tAd, tnom, tpnom, tage, tstate); + } + return i; +} + +// calcul du nombre d'entree par jour et l'affiche +int affNbmEntree( int *tpasseoupas, int tlog) { - int i; - printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\n"); - for (int i = 0; i < n; ++i) - { - printf("%d\t %c%*c\t %c%*c\t %d\t %c%*c\n", tNoClient, tNomClient, tPreClient, tAge, tStatut); - } + int i, nbentre; + for( i=0 ; i -#define TAILLE 500 +#include + + +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);//lis le fichier et met les valeurs dans les tableaux +void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang); +void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int n, int noClient ); +int afficheTous(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, 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); + + -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 ) diff --git a/testrox b/testrox deleted file mode 100755 index 79f9a05993cae2a8b025221fcac4c90976f0f8a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16960 zcmeHOeQZK_9fB~jJ>Q-t%|aC6A=Q6IXB>4UTW`l@TMCi$GN9r)j#P@9RB@9kj&Yni1YzWS zQcmbNrs^xkb_#+pk}t`Y_pC6LU(-mNid{A>7&-1Mh*POn9-j=H_N}VD>GD#i`p>9_ zD^|y%Jxw>Pj)m)E(Rg~Wez3WzzUc-}D&bip$Grf}(<$7zsasUP894CNgPn6WfA8U+ zzu)_-XYc*BK9BlMeW3cthlKn&{e*LHklh~Fw@|V?4qkp=DMQx5JFmM52ak^CWzxaV$+JS#d2NN}0cCVzIRoVklrvDyKsf{d{|x9uXRGw#nQyNaLO(ESRpyTC zL&vJd@*T^qeHW(Oic|QkS?WcJ^ggnm9?wBmyh%FU!k#`Z^;b!!Tg%gM^@Dh6FJ!`H$-11K-*?J5q z+lPtZp0w*JN3-I7xhefRL^uD(KDS-1~UF90-4UoUhrR_KIQg<<;#AIRIE0sjWm7xe(jQqDj* z1LX{qGf>VzIRoVklrvDyKsf{d#SHL!iu_(8-*exh+L+62sTU#fSWC*W`8HmwbbkMl z-cu#vwaFq|75pCL5~Z{Kqf5Dj^vBa&5`MR_d4{d?JBPU|?5pV@%-&26buxKJU3 z3d4fJX6#k15QEBr*JJ#y;x&q&P#s~uLFwG@QRT<)R&x9Q%Gu+AS-RrMpd23$3=c4+ z&UwaiO6plP-j9`@@3(5_e+~Rzd2zcx_fYZZ;-zxaM_CnqzvV6iF1{dB8uPTvX z7fuq-Glx6gdz~eCJ{Iz`1)sM<9;cosvcurQFAqGA95m{mBY3_Q@|fL4`6Rnb%oSQm zexBH0l6U9#Z4}mDBltQlS1ECHZT`mXbVwOI@yuuFo0bgWP4tF46a4rErVU zqCDe`3&~Fu@st+w=kHg$79rN5P$4e&huR})!%x1b-j%sDDE|B~1mXe?#JB@RYZmDsS>P zJp_&7sKvbfnimC!Jfi%0e;EJf`6hVsFV4@OmH#=F)R3y{jN}~^tKvoFpH}-P_7XQ!*qRbf7`?GXPcUYLtwb_q1k-~el;|IbnU)#$G?ezBoib4)m`n!u z81$3*9uY|f`%NR9?(g4&5Qk>K(<*e`nixcXEc{-dlqJL1u+`V;H~gF04Q!7oj0g*( z{kBcM&W^T1i`<(73frU%zpiS~+qVj1V_F3ibf4q>X)C!lN29IUqdo zgk^eq<7rP1p239cqhUq)T082kV6Tw2zF?|Pc*1+)sLw_#XL4A_!p zEJy*WG!V0dM`q50qNg_j)iMY1NmCh433-Y=W}lk8ePL9>njLD-VmpG%Xd&1i4Wapj zMKz;yG*vt}JHmtONM^s(mH8iWw2r}74*sXu!uOqwypB<3>C0up&*Gr91IP3IDdTc- zatMF#GS!5FGoJ5b88voPSRCID{vTLNaQl3}%gF8XZ7Q#8xY|u9(AtXQ`M#L3ijo7N z^%)g8p4UO!z|k!>$MgL&Bd_1!B1Kils@zvcYbB27`)o$qKS{#KzB(lX#Tl=uIL4h$XOxSo7xaJ88NXjSFmivn8rB)VUlh;x1&oa}IUK_6GxZ}B zobB^Eg^}0Y>|Z?o!z!N7pU{-2!dI2b!2M?ZDHN!Ej(<(FEsR~Zn*S_r|F^I><9U6= zDBq0FM_)ewOud8xttmK7e1FXQql^2?I^*kzt#QQjdTXK{B!vBJ?Xu4NJ224PbsppB%^M@e$a_h2wesc5*dE;W@Dl`A?2#d>|+Rq@=<;&|3SMuF<${_}m|78TF!u)j(NtKt$$#3}bY&+*sg8N0yoPUN}gbRAR` wj;h4d{~-?!?hk+e()Gc8cg8o +#include #include "fRox.h" -void main(void) -{ int *tNoClient, *tAge, toto, *tCActiv, *tActivite, *tPtsBought, *tPtsBonus; - char *tNomClient, *tPreClient, *tCat; - - toto =fchargement(tNoClient, tNomClient, tPreClient, tAge, tCActiv, tActivite, tActivite, tPtsBought, tPtsBonus, tCat, 500); - printf("%d\n", toto); +int main(void) +{ char nom[15], prenom[15], fnom[15], fprenom[15], bCard, member, categ, recharge, acti1[15], acti2[15], acti3[15]; + int erreur, numAd, age, state, acti, passeoupas, ptsbought,ptsbonus, numCard, avoiravecevann, testnom, testpnom, found = 0, ptrecharge, nbacti, numacti, s1, s2, s3, m1, m2, m3, f1, f2, f3, b1, b2, b3, z1, z2, z3; + FILE *f; + f = fopen("donneeClient.don","r"); + if (f==NULL){printf("Erreur ouverture fichier clients"); fclose(f); return -1;} + erreur = Fillvar(numAd, fnom, prenom, age, state, acti, passeoupas, ptsbought, ptsbonus, categ, 500)//lis le fichier et met les valeurs dans les tableaux +; + + suppr1Client(numAd, fnom, prenom, age, state, acti, passeoupas, ptsbought, ptsbonus, categ, erreur, 500); + + return 0; } From 1e52748f79a9a4b23d02af3eabc64494a5b45ba3 Mon Sep 17 00:00:00 2001 From: Lola CHALMIN Date: Thu, 10 Nov 2022 14:30:36 +0100 Subject: [PATCH 05/13] new version --- sae.c | 17 ++++++++++------- sae.h | 2 +- tsae.c | 29 +++++++++++++++++++---------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/sae.c b/sae.c index 88d0f79..28c4f54 100644 --- a/sae.c +++ b/sae.c @@ -234,7 +234,8 @@ int ChoiceActi(int nbacti, int *tacti) chxacti = chx1 + chx2*10 ; } - else + + if (nbacti == 3) { chx1 = Acti(nbacti-2); chx2 = Acti(nbacti-1); @@ -258,19 +259,18 @@ void ChoiceMenu(char *choix) } -void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int acti) +void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf) { - int u , d, c, actu, actd, actc, ptsneeded; + printf("%d\n", acti); + int u , d, c, actu = 0, actd = 0, actc = 0, ptsneeded; char confirm; u = acti % 10;//acti1 - d = (acti-u) / 10 ;//acti2 + d = (acti % 100 )/10 ;//acti2 c = acti / 100;//acti3 actu = CheckActi(u); - printf actd = CheckActi(d); actc = CheckActi(c); ptsneeded = actu + actd + actc; - printf("%d", ptsneeded); if (ptsneeded <= tptsbought[place]) { @@ -285,14 +285,17 @@ void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int tptsbought[place] += 15; tptsbonus[place] -= 100; } + + tacti[place] = acti; } } else { - printf("J'y vais pas"); + *insuf = 1; } } + int CheckActi(int nb) { if (nb == 1)//badminton diff --git a/sae.h b/sae.h index 553c944..c7092c7 100644 --- a/sae.h +++ b/sae.h @@ -10,4 +10,4 @@ int Acti(int i); void ChoiceMenu(char *choix); int CheckActi(int nb); int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); -void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int place, int acti); \ No newline at end of file +void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf); \ No newline at end of file diff --git a/tsae.c b/tsae.c index a1fa928..6bb0aa3 100644 --- a/tsae.c +++ b/tsae.c @@ -4,8 +4,8 @@ void main(void) { - int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret; - char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix; + int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf; + char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix, recharge; Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); printf("Bienvenue ! \nMembre (M) | Création compte (C)\n"); @@ -15,7 +15,7 @@ void main(void) printf("Saisir un caractère correct (Membre M ou Création C)\n"); scanf("%*c%c%*c", &member); } - + bCard = Card();//demande si carte avec client ou non @@ -76,21 +76,30 @@ void main(void) } chxacti = ChoiceActi(nbacti, tacti); - CheckPts(tptsbonus, tptsbought, tpasseoupas, place, chxacti); - + CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, &insuf); + if (insuf == 1) + { + printf("Nombre de points insuffisants : Recharge (R) ou Quitter (Q)"); + scanf("%*c%c%*c", &recharge); + if (recharge == 'R') + { + Recharge(tptsbought, place, tcateg); + } + else + { + ChoiceMenu(&choix); + } + } - tacti[place] = chxacti; ChoiceMenu(&choix); - } + } if (choix == 'Q') { //menuglobal() return; } - } - - } +} From 2924fbae0ff80d84a92f3283d583b89e277c5740 Mon Sep 17 00:00:00 2001 From: Lola CHALMIN Date: Thu, 10 Nov 2022 15:47:56 +0100 Subject: [PATCH 06/13] ok --- sae.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- sae.h | 3 ++- tsae.c | 5 +++-- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/sae.c b/sae.c index 28c4f54..45e24ad 100644 --- a/sae.c +++ b/sae.c @@ -62,7 +62,7 @@ int Fillvar(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, } fclose(f); - return 0; + return i; } @@ -254,14 +254,13 @@ void ChoiceMenu(char *choix) while (*choix != 'R' && *choix != 'A' && *choix != 'C' && *choix != 'Q') { printf("Entrer un caractère correct R | A | C | Q \n"); - scanf("%c%*c", choix); + scanf("%c%*c%*c", choix); } } void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf) { - printf("%d\n", acti); int u , d, c, actu = 0, actd = 0, actc = 0, ptsneeded; char confirm; u = acti % 10;//acti1 @@ -284,6 +283,7 @@ void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, cha { tptsbought[place] += 15; tptsbonus[place] -= 100; + tpasseoupas[place] = 1; } tacti[place] = acti; @@ -324,3 +324,44 @@ int CheckActi(int nb) } } +void Save(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 place) +{ + int i = 0; + FILE *fs; + + + fs = fopen("data.don", "a"); + if (fs == NULL) + { + printf("Erreur fichier data.don\n"); + } + fprintf(fs, "%d ", tAd[i]); + fprintf(fs, "%s ", tnom[i]); + fprintf(fs, "%s\t", tpnom[i]); + fprintf(fs, "%d\t", tage[i]); + fprintf(fs, "%d\t", tstate[i]); + fprintf(fs, "%d\t", tacti[i]); + fprintf(fs, "%d\t", tpasseoupas[i]); + fprintf(fs, "%d\t", tptsbought[i]); + fprintf(fs, "%d\t", tptsbonus[i]); + fprintf(fs, "%c", tcateg[i]); + + i++; + for (i; i < place; i++) + { + fprintf(fs, "%d ", tAd[i]); + fprintf(fs, "%s ", tnom[i]); + fprintf(fs, "%s\t", tpnom[i]); + fprintf(fs, "%d\t", tage[i]); + fprintf(fs, "%d\t", tstate[i]); + fprintf(fs, "%d\t", tacti[i]); + fprintf(fs, "%d\t", tpasseoupas[i]); + fprintf(fs, "%d\t", tptsbought[i]); + fprintf(fs, "%d\t", tptsbonus[i]); + fprintf(fs, "%c", tcateg[i]); + } + + + + +} \ No newline at end of file diff --git a/sae.h b/sae.h index c7092c7..503f7d5 100644 --- a/sae.h +++ b/sae.h @@ -10,4 +10,5 @@ int Acti(int i); void ChoiceMenu(char *choix); int CheckActi(int nb); int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); -void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf); \ No newline at end of file +void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf); +void Save(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 place); \ No newline at end of file diff --git a/tsae.c b/tsae.c index 6bb0aa3..1a766bc 100644 --- a/tsae.c +++ b/tsae.c @@ -4,9 +4,9 @@ void main(void) { - int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf; + int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf, day = 0; char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix, recharge; - Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); + place = Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); printf("Bienvenue ! \nMembre (M) | Création compte (C)\n"); scanf("%c%*c", &member); @@ -51,6 +51,7 @@ void main(void) } } + ChoiceMenu(&choix); if (choix == 'A') From 86f2d9d8bfca7dce8044ae35ed76fa083fa59aca Mon Sep 17 00:00:00 2001 From: Lola CHALMIN Date: Thu, 10 Nov 2022 17:28:47 +0100 Subject: [PATCH 07/13] et voila --- sae.c | 109 ++++++++++++++++++++++++++++++++++++++++----------------- sae.h | 5 +-- tsae.c | 78 +++++++---------------------------------- 3 files changed, 93 insertions(+), 99 deletions(-) diff --git a/sae.c b/sae.c index 45e24ad..7df43dc 100644 --- a/sae.c +++ b/sae.c @@ -16,16 +16,16 @@ int Fillvar(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; char categ, fnom[15], fprenom[15]; - fscanf(f, "%d", &numAd); - fscanf(f, "%*c%s", fnom); - fscanf(f, "%*c%s", fprenom); - fscanf(f, "%*c%d", &age); - fscanf(f, "%*c%d", &state); - fscanf(f, "%*c%d", &acti); - fscanf(f, "%*c%d", &passeoupas); - fscanf(f, "%*c%d", &ptsbought); - fscanf(f, "%*c%d%*c", &ptsbonus); - fscanf(f, "%*c%c", &categ); + fscanf(f, "%d%*c", &numAd); + fscanf(f, "%s%*c", fnom); + fscanf(f, "%s%*c", fprenom); + fscanf(f, "%d%*c", &age); + fscanf(f, "%d%*c", &state); + fscanf(f, "%d%*c", &acti); + fscanf(f, "%d%*c", &passeoupas); + fscanf(f, "%d%*c", &ptsbought); + fscanf(f, "%d%*c", &ptsbonus); + fscanf(f, "%c%*c", &categ); while (!feof(f)) { @@ -49,18 +49,19 @@ int Fillvar(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, i++; - fscanf(f, "%d", &numAd); - fscanf(f, "%*c%s", fnom); - fscanf(f, "%*c%s", fprenom); - fscanf(f, "%*c%d", &age); - fscanf(f, "%*c%d", &state); - fscanf(f, "%*c%d", &acti); - fscanf(f, "%*c%d", &passeoupas); - fscanf(f, "%*c%d", &ptsbought); - fscanf(f, "%*c%d%*c", &ptsbonus); - fscanf(f, "%*c%c", &categ); + fscanf(f, "%d%*c", &numAd); + fscanf(f, "%s%*c", fnom); + fscanf(f, "%s%*c", fprenom); + fscanf(f, "%d%*c", &age); + fscanf(f, "%d%*c", &state); + fscanf(f, "%d%*c", &acti); + fscanf(f, "%d%*c", &passeoupas); + fscanf(f, "%d%*c", &ptsbought); + fscanf(f, "%d%*c", &ptsbonus); + fscanf(f, "%c%*c", &categ); } + fclose(f); return i; } @@ -164,12 +165,7 @@ void Recharge(int *tptsbought, int place, char *tcateg) { int dizpts, topay, nbpts; printf("Combien de dizaines de points souhaitez-vous acheter ?\n"); - scanf("%d", &dizpts); - while (dizpts > 100 || dizpts < 0) - { - printf("Veuillez entrer un nombre correct de dizaines de points\n"); - scanf("%d", &dizpts); - } + scanf("%d%*c", &dizpts); if (tcateg[place] == 'E') { @@ -247,15 +243,17 @@ int ChoiceActi(int nbacti, int *tacti) -void ChoiceMenu(char *choix) +int ChoiceMenu(void) { - printf("Recharge carte (R) | Afficher points (A) | Choix activités (C) | Quitter (Q)\n"); - scanf("%*c%c%*c", choix); - while (*choix != 'R' && *choix != 'A' && *choix != 'C' && *choix != 'Q') + int choix; + printf("Recharge carte (1) | Afficher points (2) | Choix activités (3) | Quitter (4)\n"); + scanf("%d", &choix); + while (choix > 4 || choix < 1) { - printf("Entrer un caractère correct R | A | C | Q \n"); - scanf("%c%*c%*c", choix); + printf("Entrer un caractère correct 1 | 2 | 3 | 4 \n"); + scanf("%d%*c", &choix); } + return choix; } @@ -364,4 +362,51 @@ void Save(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, i +} + + + + +void Loop(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int *choix, int *insuf, int place, int nbacti) +{ + int chxacti; + char recharge; + while (*choix != 4) + { + + if (*choix == 2) + { + printf("La carte dispose de %d points.\n", tptsbought[place]);//infos sur ses points + } + + if (*choix == 1) + { + Recharge(tptsbought, place, tcateg); + } + + if (*choix == 3) + { + printf("Nombre d'activités souhaitées ? (max 3)\n"); + scanf("%*c%d", &nbacti); + while (nbacti < 0 || nbacti > 3) + { + printf("Nombre d'activités incorrect (max 3)\n"); + scanf("%*c%d", &nbacti); + } + + chxacti = ChoiceActi(nbacti, tacti); + CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, insuf); + if (*insuf == 1) + { + printf("Nombre de points insuffisants : Recharge (R) ou Quitter (Q)"); + scanf("%*c%c%*c", &recharge); + if (recharge == 'R') + { + Recharge(tptsbought, place, tcateg); + } + } + } + + *choix = ChoiceMenu(); + } } \ No newline at end of file diff --git a/sae.h b/sae.h index 503f7d5..20c407a 100644 --- a/sae.h +++ b/sae.h @@ -7,8 +7,9 @@ int FindData(char *nom, char *prenom, char tnom[][15], char tpnom[][15], int *tp void Recharge(int *tptsbought, int place, char *tcateg); int ChoiceActi(int nbacti, int *tacti); int Acti(int i); -void ChoiceMenu(char *choix); +int ChoiceMenu(void); int CheckActi(int nb); int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf); -void Save(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 place); \ No newline at end of file +void Save(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 place); +void Loop(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int *choix, int *insuf, int place, int nbacti); \ No newline at end of file diff --git a/tsae.c b/tsae.c index 1a766bc..e2d14ec 100644 --- a/tsae.c +++ b/tsae.c @@ -4,29 +4,12 @@ void main(void) { - int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf, day = 0; - char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix, recharge; + int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, choix, chxacti, numAd, ret, insuf, day = 0; + char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, tnom[TAILLE][15], tpnom[TAILLE][15], action, recharge; place = Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); - - printf("Bienvenue ! \nMembre (M) | Création compte (C)\n"); - scanf("%c%*c", &member); - while (member != 'M' && member != 'C') - { - printf("Saisir un caractère correct (Membre M ou Création C)\n"); - scanf("%*c%c%*c", &member); - } - - bCard = Card();//demande si carte avec client ou non - if (member == 'C')//si il y a besoin de créer un compte - { - //à voir avec evann - return; - } - - if (member == 'M')//si le client est déjà membre - { + if (bCard == 'N')// si client n'a pas la carte { Name(nom, pnom); @@ -51,56 +34,21 @@ void main(void) } } - - ChoiceMenu(&choix); - - if (choix == 'A') - { - printf("La carte dispose de %d points.\n", tptsbought[place]);//infos sur ses points - ChoiceMenu(&choix); - } - - if (choix == 'R') - { - Recharge(tptsbought, place, tcateg); - ChoiceMenu(&choix); - } - - if (choix == 'C') - { - printf("Nombre d'activités souhaitées ? (max 3)\n"); - scanf("%d", &nbacti); - while (nbacti < 0 || nbacti > 3) - { - printf("Nombre d'activités incorrect (max 3)\n"); - scanf("%d", &nbacti); - } - - chxacti = ChoiceActi(nbacti, tacti); - CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, &insuf); - if (insuf == 1) - { - printf("Nombre de points insuffisants : Recharge (R) ou Quitter (Q)"); - scanf("%*c%c%*c", &recharge); - if (recharge == 'R') - { - Recharge(tptsbought, place, tcateg); - } - else - { - ChoiceMenu(&choix); - } - } - - ChoiceMenu(&choix); + choix = ChoiceMenu(); + Loop(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, &choix, &insuf, place, nbacti); - } + + - if (choix == 'Q') + if (choix == 4) { //menuglobal() return; } - } + + /*while (choix != 4) + { + choix =ChoiceMenu(); + }*/ } From d5d6f59b3d91b09bba53120f9abae2a5ae472a73 Mon Sep 17 00:00:00 2001 From: Evann ABRIAL Date: Thu, 10 Nov 2022 17:35:37 +0100 Subject: [PATCH 08/13] travail jeudi aprem --- commun.c | 725 +++++++++++++++++++++++++++++++++++++++++++++------- evsae.c | 97 +++++-- evtestsae.c | 6 +- hCommun.h | 38 +-- tsae.c | 2 +- 5 files changed, 735 insertions(+), 133 deletions(-) diff --git a/commun.c b/commun.c index a110713..fcbe6b0 100644 --- a/commun.c +++ b/commun.c @@ -1,4 +1,6 @@ //main commun +#include +#include #include "hCommun.h" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -7,68 +9,451 @@ 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)//lis le fichier et met les valeurs dans les tableaux { - FILE *f; - f = fopen("donneeClient.don", "r"); - if (f == NULL) + FILE *f; + f = fopen("donneeClient.don", "r"); + if (f == NULL) + { + printf("Problème d'ouverture du fichier Clients..."); + return -1; + } + int i = 0; + int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; + char categ, fnom[15], fprenom[15]; + + fscanf(f, "%6d", &numAd); + fscanf(f, "%s", fnom); + fscanf(f, "%s", fprenom); + fscanf(f, "%2d", &age); + fscanf(f, "%d", &state); + fscanf(f, "%d", &acti); + fscanf(f, "%d", &passeoupas); + fscanf(f, "%2d", &ptsbought); + fscanf(f, "%2d%*c", &ptsbonus); + fscanf(f, "%c", &categ); + + while (!feof(f)) + { + if (i == tmax) + { + printf("Problème de gestion: trop de clients enregistrés à ce jour"); + return -1; + } + + + tAd[i] = numAd; + strcpy(tnom[i], fnom); + strcpy(tpnom[i], fprenom); + tage[i] = age; + tstate[i] = state; + tacti[i] = acti; + tpasseoupas[i] = passeoupas; + tptsbought[i] = ptsbought; + tptsbonus[i] = ptsbonus; + tcateg[i] = categ; + + i++; + + fscanf(f, "%6d", &numAd); + fscanf(f, "%s", fnom); + fscanf(f, "%s", fprenom); + fscanf(f, "%2d", &age); + fscanf(f, "%d", &state); + fscanf(f, "%d", &acti); + fscanf(f, "%d", &passeoupas); + fscanf(f, "%2d", &ptsbought); + fscanf(f, "%2d%*c", &ptsbonus); + fscanf(f, "%c", &categ); + + } + fclose(f); + return i; +} +void GereAdhérent(void) +{ + int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf; + char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix, recharge; + place = Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); + + bCard = Card();//demande si carte avec client ou non + + + + if (bCard == 'N')// si client n'a pas la carte + { + Name(nom, pnom); + + puts("Recherche de la carte !"); + + place = FindData(nom, pnom, tnom, tpnom, tpasseoupas, tptsbought, &action, 500); + if (place == -1) + { + return; + } + } + + if (bCard == 'O') + { + printf("Numéro carte : \t"); + scanf("%*c%d", &numAd); + ret = FindN(tAd, numAd, tpasseoupas, 500); + if (ret == -1) + { + GereAdhérent(); + } + } + + + ChoiceMenu(&choix); + + if (choix == 'A') + { + printf("La carte dispose de %d points.\n", tptsbought[place]);//infos sur ses points + ChoiceMenu(&choix); + } + + if (choix == 'R') + { + Recharge(tptsbought, place, tcateg); + ChoiceMenu(&choix); + } + + if (choix == 'C') + { + printf("Nombre d'activités souhaitées ? (max 3)\n"); + scanf("%d", &nbacti); + while (nbacti < 0 || nbacti > 3) + { + printf("Nombre d'activités incorrect (max 3)\n"); + scanf("%d", &nbacti); + } + + chxacti = ChoiceActi(nbacti, tacti); + CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, &insuf); + if (insuf == 1) + { + printf("Nombre de points insuffisants : Recharge (R) ou Quitter (Q)"); + scanf("%c%*c", &recharge); + if (recharge == 'R') + { + Recharge(tptsbought, place, tcateg); + } + else + { + ChoiceMenu(&choix); + } + } + + + ChoiceMenu(&choix); + + } + + if (choix == 'Q') { - printf("Problème d'ouverture du fichier Clients..."); + //menuglobal() + return; + } +} + +char Card(void)//demande si client a la carte +{ + char bCard; + printf("Avez-vous votre numéro de carte adhérent avec vous ?(O/N)\n"); + scanf("%c", &bCard); + return bCard; +} + + + +void Name( char *nom, char *prenom)//demande nom et prénom +{ + printf("Dans ce cas, quel est votre nom ?\n"); + scanf("%s", nom); + + printf("Et votre prénom ?\n"); + scanf("%s", prenom); +} + + + + +int FindData(char *nom, char *pnom, char tnom[][15], char tpnom[][15], int *tpasseoupas, int *tptsbought, char *action, int tmax) +{ + int i, found = 0, testnom, testpnom; + i = 0; + testnom = strcmp(tnom[i], nom);//comparer nom du fichier et nom donné + testpnom = strcmp(tpnom[i], pnom);//comparer prénom du fichier et prénom donné + while (found == 0 && i < tmax) + { + if (testnom == 0) + { + if (testpnom == 0) + found = 1; + break; + } + i++; + testnom = strcmp(tnom[i], nom); + testpnom = strcmp(tpnom[i], pnom); + } + + if (found == 0) + { + printf("Recherche non aboutie : numéro non enregistré...\n");//si le client n'est au final pas enregistré return -1; } - int i = 0; - int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; - char categ, fnom[15], fprenom[15]; - - fscanf(f, "%6d", &numAd); - fscanf(f, "%s", fnom); - fscanf(f, "%s", fprenom); - fscanf(f, "%2d", &age); - fscanf(f, "%d", &state); - fscanf(f, "%d", &acti); - fscanf(f, "%d", &passeoupas); - fscanf(f, "%2d", &ptsbought); - fscanf(f, "%2d%*c", &ptsbonus); - fscanf(f, "%c", &categ); - - while (!feof(f)) - { - if (i == tmax) + + if (found == 1)//si trouvé + { + if (tpasseoupas[i] == 1)//si client déjà passé { - printf("Problème de gestion: trop de clients enregistrés à ce jour"); + printf("Déjà passé, nombre possible de passage dans une journée : 1...\n"); return -1; } + printf("Carte trouvée !\n"); + return i; + } +} - tAd[i] = numAd; - strcpy(tnom[i], fnom); - strcpy(tpnom[i], fprenom); - tage[i] = age; - tstate[i] = state; - tacti[i] = acti; - tpasseoupas[i] = passeoupas; - tptsbought[i] = ptsbought; - tptsbonus[i] = ptsbonus; - tcateg[i] = categ; +int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax) +{ + int i, found = 0; + i = 0; + while (found == 0 && i < tmax) + { + if(tAd[i] == numAd) + { + break; + } i++; + } + + if (found == 0) + { + printf("Recherche non aboutie : numéro non enregistré...\n");//si le client n'est au final pas enregistré + return -1; + } + + if (found == 1)//si trouvé + { + if (tpasseoupas[i] == 1)//si client déjà passé + { + printf("Déjà passé, nombre possible de passage dans une journée : 1...\n"); + return -1; + } + printf("Carte trouvée !\n"); + return i; + } +} + + +void Recharge(int *tptsbought, int place, char *tcateg) +{ + int dizpts, topay, nbpts; + printf("Combien de dizaines de points souhaitez-vous acheter ?\n"); + scanf("%d", &dizpts); + while (dizpts > 100 || dizpts < 0) + { + printf("Veuillez entrer un nombre correct de dizaines de points\n"); + scanf("%d", &dizpts); + } + + if (tcateg[place] == 'E') + { + nbpts = dizpts * 10; + topay = dizpts * 2; + tptsbought[place] += nbpts; + + printf("Vous avez désormais %d points sur la carte, vous nous devez %d €\n", tptsbought[place], topay); + } + + if (tcateg[place] == 'S') + { + nbpts = dizpts * 10; + topay = dizpts * 4; + tptsbought[place] += nbpts; + + printf("Vous avez désormais %d points sur la carte, vous nous devez %d €\n", tptsbought[place], topay); + } + + if (tcateg[place] == 'A') + { + nbpts = dizpts * 10; + topay = dizpts * 6; + tptsbought[place] += nbpts; + + printf("Vous avez désormais %d points sur la carte, vous nous devez %d €\n", tptsbought[place], topay); + } + +} + + + +int Acti(int i) +{ + int acti; + printf("Choix de l'activité %d: badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5) \n", i); + scanf("%*c%d%*c", &acti); + while (acti != 1 && acti != 2 && acti != 3 && acti != 4 && acti != 5) + { + printf("Veuillez entrer un nombre d'activité correct (badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5))\n"); + scanf("%d%*c", &acti); + } + return acti; +} + + + +int ChoiceActi(int nbacti, int *tacti) +{ + int chxacti, chx1, chx2, chx3; + + if (nbacti == 1) + { + chxacti = Acti(nbacti); + } + - fscanf(f, "%6d", &numAd); - fscanf(f, "%s", fnom); - fscanf(f, "%s", fprenom); - fscanf(f, "%2d", &age); - fscanf(f, "%d", &state); - fscanf(f, "%d", &acti); - fscanf(f, "%d", &passeoupas); - fscanf(f, "%2d", &ptsbought); - fscanf(f, "%2d%*c", &ptsbonus); - fscanf(f, "%c", &categ); + if (nbacti == 2) + { + chx1 = Acti(nbacti-1); + chx2 = Acti(nbacti); + chxacti = chx1 + chx2*10 ; + + } + if (nbacti == 3) + { + chx1 = Acti(nbacti-2); + chx2 = Acti(nbacti-1); + chx3 = Acti(nbacti); + chxacti = chx1 + chx2*10 + chx3*100; } - fclose(f); - return 0; + return chxacti; } +void ChoiceMenu(char *choix) +{ + printf("Recharge carte (R) | Afficher points (A) | Choix activités (C) | Quitter (Q)\n"); + scanf("%c%*c", choix); + while (*choix != 'R' && *choix != 'A' && *choix != 'C' && *choix != 'Q') + { + printf("Entrer un caractère correct R | A | C | Q \n"); + scanf("%c%*c%*c", choix); + } +} + + +void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf) +{ + int u , d, c, actu = 0, actd = 0, actc = 0, ptsneeded; + char confirm; + u = acti % 10;//acti1 + d = (acti % 100 )/10 ;//acti2 + c = acti / 100;//acti3 + actu = CheckActi(u); + actd = CheckActi(d); + actc = CheckActi(c); + ptsneeded = actu + actd + actc; + + if (ptsneeded <= tptsbought[place]) + { + ("Points suffisants, confirmation ? (O/N) \n"); + scanf("%c%*c", &confirm); + if (confirm == 'O') + { + tptsbought[place] -= ptsneeded; + tptsbonus[place] += ptsneeded; + if (tptsbonus[place] >= 100) + { + tptsbought[place] += 15; + tptsbonus[place] -= 100; + tpasseoupas[place] = 1; + } + + tacti[place] = acti; + } + } + else + { + *insuf = 1; + } +} + + +int CheckActi(int nb) +{ + if (nb == 1)//badminton + { + return 8; + } + + if (nb == 2)//football + { + return 5; + } + + if (nb == 3)//zumba + { + return 5; + } + + if (nb == 4)//muscu + { + return 15; + } + + if (nb == 5)//squash + { + return 10; + } +} + +void Save(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 place) +{ + int i = 0; + FILE *fs; + + + fs = fopen("data.don", "a"); + if (fs == NULL) + { + printf("Erreur fichier data.don\n"); + } + fprintf(fs, "%d ", tAd[i]); + fprintf(fs, "%s ", tnom[i]); + fprintf(fs, "%s\t", tpnom[i]); + fprintf(fs, "%d\t", tage[i]); + fprintf(fs, "%d\t", tstate[i]); + fprintf(fs, "%d\t", tacti[i]); + fprintf(fs, "%d\t", tpasseoupas[i]); + fprintf(fs, "%d\t", tptsbought[i]); + fprintf(fs, "%d\t", tptsbonus[i]); + fprintf(fs, "%c", tcateg[i]); + + i++; + for (i; i < place; i++) + { + fprintf(fs, "%d ", tAd[i]); + fprintf(fs, "%s ", tnom[i]); + fprintf(fs, "%s\t", tpnom[i]); + fprintf(fs, "%d\t", tage[i]); + fprintf(fs, "%d\t", tstate[i]); + fprintf(fs, "%d\t", tacti[i]); + fprintf(fs, "%d\t", tpasseoupas[i]); + fprintf(fs, "%d\t", tptsbought[i]); + fprintf(fs, "%d\t", tptsbonus[i]); + fprintf(fs, "%c", tcateg[i]); + } + + + + +} + @@ -92,22 +477,20 @@ void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang) *rang = i; return; } - if(tAd[i] > noClient) - - *rang = i; - return; } + *coderet=0; } //Affichage D'UN client avec toutes ses données. -void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int n, int noClient ) -{ - int i, coderet, rang, trouve, NonTrouve; +void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage,int *tstate, int n, int noClient , int *tptsbought, char *tcateg) + { + int i, coderet, rang, trouve; fRecherche(tAd, n, noClient, &coderet, &rang); trouve = coderet; + printf("%d",trouve); while (trouve == 0) { @@ -115,16 +498,19 @@ void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, i { printf("Le numero client n'a pas été trouvé \n"); printf("Veuillez entrer a nouveau le N° Client ou taper -1 pour annuler\n"); - scanf("%d", &NonTrouve); - } - if(NonTrouve==-1) + scanf("%d", &noClient); + fRecherche(tAd, n, noClient, &coderet, &rang); + trouve=coderet; + printf("%d", trouve); + if(noClient==-1) + { return; - else - fRecherche(tAd, n, noClient, &coderet, &rang); - trouve=coderet; + } + } - printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\n"); - printf("%d\t %s \t %S\t %d\t %S\n", tAd[rang], tnom[rang], tpnom[rang], tage[rang], tstate[rang]); +} + printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\t Nombre de points \t \n"); + printf("%d\t %s \t %s\t %d\t %c \t%d\n", tAd[rang], tnom[rang], tpnom[rang], tage[rang], tcateg[rang], tptsbought[rang]); } @@ -146,9 +532,9 @@ int affNbmEntree( int *tpasseoupas, int tlog) { int i, nbentre; for( i=0 ; i VSUIVANTE) + { + VSUIVANTE=next; + } + } + printf("\n###########################################################\n"); + printf("\nQue souhaitez vous faire? |"); + printf("\n |"); + printf("\n\t1- Créer un compte |\n"); + printf("\t2- Adhérent |\n"); + printf("\t3- Accueil client |\n"); + printf("\t4- Suppression |\n"); + printf("\t5- Carte |\n"); + printf("\t6- Fin de journée |\n"); + printf("\tControle C pour quitter sans sauvegarder |\n"); + printf("\n###########################################################\n\n"); + + //printf("\nTapez h pour une aide\n"); + scanf("%d%*c", &choix); + + while (1 > choix || choix> 6) + { + printf("\nEntrez soit 1, soit 2.\t"); + scanf("%d%*c", &choix); + } +/* + if (choix == 'h') + { + printf("\n\tBienvenue dans notre application!\n"); + printf("\nVous êtes arrivées dans le menu de notre incroyable salle de sport\n"); + printf("Tapez le nombre au début de la liste des fonctionnalitées pour y accéder"); + printf("\nSi vous êtes nouveau, nous vous conseillons de créer un compte en tapant 1 dan le menu"); + printf("\nTapez O pour retourner au menu principal\n"); + scanf("%c",&retourmenu); + + while ( retourmenu != 'O') + { + printf("\nTapez la lettre O pour revenir au menu.\t"); + scanf("%*c%c%*c", &retourmenu); + } + + if (retourmenu == 'O') + Index(); + + } +*/ + if (choix == 1) + { + creationCompte( &VSUIVANTE); + } + + if (choix == 2) + { + menuAff(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500, n); + } + + if (choix == 3) + { + GereAdhérent(); + } + + } + +void creationCompte(int *VSUIVANTE) + { + char nom[15], prenom[20], categorie, gen, retour; + int age, nclient; + FILE *fe, *fx, *fn; + fe= fopen("donneClient.don", "a"); + fx= fopen("x.don","a"); + + + if (fe==NULL) + { + printf(" Erreur ouverture fichier"); + } + + printf("\nEntrez votre nom\n"); + scanf("%s%*c", nom); + + printf("\nEntrez votre prenom\n"); + scanf("%s%*c", prenom); + + printf("\nEntrez votre age\n"); + scanf("%d%*c", &age); + + printf("Avez-vous un tarif spécial: Etudiant(E), Senior(S), aucun(A)?\n"); + scanf("%c%*c", &categorie); + + + fprintf(fe,"\n%d\t",*VSUIVANTE); + fprintf(fe,"%s\t",nom); + fprintf(fe,"%s\t",prenom); + fprintf(fe,"%d\t",age); + fprintf(fe, "0\t"); //état de la carte + fprintf(fe, "0\t"); //activité + fprintf(fe, "0\t"); //passé ou pas + fprintf(fe, "30\t"); //point acheté + fprintf(fe, "0\t"); //point cumulé + fprintf(fe,"%c",categorie); + + *VSUIVANTE=*VSUIVANTE+1; + + fprintf(fx,"\n%d",*VSUIVANTE); + + printf("Ajoutez un contact?(O/N)\n"); + scanf("%c%*c", &retour); + + if (retour == 'O') + creationCompte(VSUIVANTE); + else + return; + +} + +void menuAff (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 choix, noClient; + printf("\n1-Affiche un client"); + printf("\n1-Affiche un client"); + printf("\n1-Affiche un client"); + + scanf("%d%*c", &choix); + + if ( choix == 1) + { + printf("\nNuméro du client recherché?"); + scanf("%d%*c", &noClient); + fAffichage1Client(tAd, tnom, tpnom, tage, tstate, n, noClient, tptsbought, tcateg); + } + } + diff --git a/evsae.c b/evsae.c index 7946af4..6644576 100644 --- a/evsae.c +++ b/evsae.c @@ -73,22 +73,6 @@ void menu (void) } - -/* -void c(void) - { - int x=10000000, i=0; - FILE *fe; - fe = fopen("nclient.don","w"); - - for (i=0; i +#include +#define TAILLE 500 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); +void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage,int *tstate, int n, int noClient , int *tptsbought, char *tcateg); +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); char Card(void);//check si le client a la carte -void Name( char *nom, char *prenom); -void scanNandP(char *nom, char *prenom); - +void Index(void); +void creationCompte(int *VSUIVANTE); +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); +void Recharge(int *tptsbought, int place, char *tcateg); +int ChoiceActi(int nbacti, int *tacti); +int Acti(int i); +void ChoiceMenu(char *choix); +int CheckActi(int nb); +int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); +void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf); +void GereAdhérent(void); +void Save(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 place); +void menuAff (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); diff --git a/tsae.c b/tsae.c index 1a766bc..f1b65c4 100644 --- a/tsae.c +++ b/tsae.c @@ -2,7 +2,7 @@ #include #include -void main(void) +void GereAdhérent(void) { int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf, day = 0; char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix, recharge; From 9c211d289db0ac2f78ccc580233eb46120510a1c Mon Sep 17 00:00:00 2001 From: L0ol4X Date: Fri, 11 Nov 2022 10:12:59 +0100 Subject: [PATCH 09/13] voilaa --- sae.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sae.c b/sae.c index 7df43dc..9718a16 100644 --- a/sae.c +++ b/sae.c @@ -202,8 +202,8 @@ int Acti(int i) { int acti; printf("Choix de l'activité %d: badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5) \n", i); - scanf("%*c%d", &acti); - while (acti != 1 && acti != 2 && acti != 3 && acti != 4 && acti != 5) + scanf("%d%*c", &acti); + while (acti <= 0 && acti >= 6) { printf("Veuillez entrer un nombre d'activité correct (badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5))\n"); scanf("%d%*c", &acti); @@ -394,7 +394,7 @@ void Loop(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, i scanf("%*c%d", &nbacti); } - chxacti = ChoiceActi(nbacti, tacti); + chxacti = ChoiceActi(nbacti, tacti); CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, insuf); if (*insuf == 1) { @@ -409,4 +409,4 @@ void Loop(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, i *choix = ChoiceMenu(); } -} \ No newline at end of file +} From 06077ee8e42f5da13f247d6b744068f1ba6e17c1 Mon Sep 17 00:00:00 2001 From: lolax Date: Fri, 11 Nov 2022 10:38:21 +0100 Subject: [PATCH 10/13] it works --- sae.c | 12 +++++++----- testlo | Bin 17096 -> 0 bytes tsae.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) delete mode 100755 testlo diff --git a/sae.c b/sae.c index 9718a16..e8bfff7 100644 --- a/sae.c +++ b/sae.c @@ -173,7 +173,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') @@ -182,7 +182,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') @@ -191,7 +191,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); } } @@ -271,12 +271,14 @@ void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, cha if (ptsneeded <= tptsbought[place]) { - ("Points suffisants, confirmation ? (O/N) \n"); - scanf("%*c%c%*c", &confirm); + printf("Points suffisants, confirmation ? (O/N) \n"); + scanf("%c%*c", &confirm); if (confirm == 'O') { tptsbought[place] -= ptsneeded; tptsbonus[place] += ptsneeded; + printf("Achat effectué\n"); + if (tptsbonus[place] >= 100) { tptsbought[place] += 15; diff --git a/testlo b/testlo deleted file mode 100755 index 15060d028a124d14b848f5a003e1578d18f66146..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17096 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 #include -void GereAdhérent(void) +void main(void) { int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, choix, chxacti, numAd, ret, insuf, day = 0; char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, tnom[TAILLE][15], tpnom[TAILLE][15], action, recharge; From 37f349a24a8ef9856e0e6a00381e09a8e1d24ad0 Mon Sep 17 00:00:00 2001 From: L0ol4X Date: Fri, 11 Nov 2022 11:18:19 +0100 Subject: [PATCH 11/13] change version of lo.c in commun and .h --- commun.c | 332 +++++++++++++++++++++++++++--------------------------- hCommun.h | 3 +- 2 files changed, 168 insertions(+), 167 deletions(-) diff --git a/commun.c b/commun.c index fcbe6b0..ae345bd 100644 --- a/commun.c +++ b/commun.c @@ -9,152 +9,107 @@ 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)//lis le fichier et met les valeurs dans les tableaux { - FILE *f; - f = fopen("donneeClient.don", "r"); - if (f == NULL) - { - printf("Problème d'ouverture du fichier Clients..."); - return -1; - } - int i = 0; - int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; - char categ, fnom[15], fprenom[15]; - - fscanf(f, "%6d", &numAd); - fscanf(f, "%s", fnom); - fscanf(f, "%s", fprenom); - fscanf(f, "%2d", &age); - fscanf(f, "%d", &state); - fscanf(f, "%d", &acti); - fscanf(f, "%d", &passeoupas); - fscanf(f, "%2d", &ptsbought); - fscanf(f, "%2d%*c", &ptsbonus); - fscanf(f, "%c", &categ); - - while (!feof(f)) - { - if (i == tmax) - { - printf("Problème de gestion: trop de clients enregistrés à ce jour"); - return -1; - } - - - tAd[i] = numAd; - strcpy(tnom[i], fnom); - strcpy(tpnom[i], fprenom); - tage[i] = age; - tstate[i] = state; - tacti[i] = acti; - tpasseoupas[i] = passeoupas; - tptsbought[i] = ptsbought; - tptsbonus[i] = ptsbonus; - tcateg[i] = categ; - - i++; - - fscanf(f, "%6d", &numAd); - fscanf(f, "%s", fnom); - fscanf(f, "%s", fprenom); - fscanf(f, "%2d", &age); - fscanf(f, "%d", &state); - fscanf(f, "%d", &acti); - fscanf(f, "%d", &passeoupas); - fscanf(f, "%2d", &ptsbought); - fscanf(f, "%2d%*c", &ptsbonus); - fscanf(f, "%c", &categ); - - } - fclose(f); - return i; -} -void GereAdhérent(void) -{ - int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, insuf; - char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, tnom[TAILLE][15], tpnom[TAILLE][15], action, choix, recharge; - place = Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); - - bCard = Card();//demande si carte avec client ou non + FILE *f; + f = fopen("donneeClient.don", "r"); + if (f == NULL) + { + printf("Problème d'ouverture du fichier Clients..."); + return -1; + } + int i = 0; + int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; + char categ, fnom[15], fprenom[15]; + + fscanf(f, "%d%*c", &numAd); + fscanf(f, "%s%*c", fnom); + fscanf(f, "%s%*c", fprenom); + fscanf(f, "%d%*c", &age); + fscanf(f, "%d%*c", &state); + fscanf(f, "%d%*c", &acti); + fscanf(f, "%d%*c", &passeoupas); + fscanf(f, "%d%*c", &ptsbought); + fscanf(f, "%d%*c", &ptsbonus); + fscanf(f, "%c%*c", &categ); + + while (!feof(f)) + { + if (i == tmax) + { + printf("Problème de gestion: trop de clients enregistrés à ce jour"); + return -1; + } + tAd[i] = numAd; + strcpy(tnom[i], fnom); + strcpy(tpnom[i], fprenom); + tage[i] = age; + tstate[i] = state; + tacti[i] = acti; + tpasseoupas[i] = passeoupas; + tptsbought[i] = ptsbought; + tptsbonus[i] = ptsbonus; + tcateg[i] = categ; - if (bCard == 'N')// si client n'a pas la carte - { - Name(nom, pnom); + i++; - puts("Recherche de la carte !"); + fscanf(f, "%d%*c", &numAd); + fscanf(f, "%s%*c", fnom); + fscanf(f, "%s%*c", fprenom); + fscanf(f, "%d%*c", &age); + fscanf(f, "%d%*c", &state); + fscanf(f, "%d%*c", &acti); + fscanf(f, "%d%*c", &passeoupas); + fscanf(f, "%d%*c", &ptsbought); + fscanf(f, "%d%*c", &ptsbonus); + fscanf(f, "%c%*c", &categ); - place = FindData(nom, pnom, tnom, tpnom, tpasseoupas, tptsbought, &action, 500); - if (place == -1) - { - return; - } } - if (bCard == 'O') - { - printf("Numéro carte : \t"); - scanf("%*c%d", &numAd); - ret = FindN(tAd, numAd, tpasseoupas, 500); - if (ret == -1) - { - GereAdhérent(); - } - } + fclose(f); + return i; +} - - ChoiceMenu(&choix); - if (choix == 'A') - { - printf("La carte dispose de %d points.\n", tptsbought[place]);//infos sur ses points - ChoiceMenu(&choix); - } - if (choix == 'R') - { - Recharge(tptsbought, place, tcateg); - ChoiceMenu(&choix); - } +void GereAdhérent(void) +{ + int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, choix, chxacti, numAd, ret, insuf, day = 0; + char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, tnom[TAILLE][15], tpnom[TAILLE][15], action, recharge; + place = Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); + bCard = Card();//demande si carte avec client ou non - if (choix == 'C') - { - printf("Nombre d'activités souhaitées ? (max 3)\n"); - scanf("%d", &nbacti); - while (nbacti < 0 || nbacti > 3) - { - printf("Nombre d'activités incorrect (max 3)\n"); - scanf("%d", &nbacti); - } - chxacti = ChoiceActi(nbacti, tacti); - CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, &insuf); - if (insuf == 1) + if (bCard == 'N')// si client n'a pas la carte { - printf("Nombre de points insuffisants : Recharge (R) ou Quitter (Q)"); - scanf("%c%*c", &recharge); - if (recharge == 'R') + Name(nom, pnom); + + puts("Recherche de la carte !"); + + place = FindData(nom, pnom, tnom, tpnom, tpasseoupas, tptsbought, &action, 500); + if (place == -1) { - Recharge(tptsbought, place, tcateg); + return; } - else + } + + if (bCard == 'O') + { + printf("Numéro carte : \t"); + scanf("%*c%d", &numAd); + ret = FindN(tAd, numAd, tpasseoupas, 500); + if (ret == -1) { - ChoiceMenu(&choix); + main(); } } - ChoiceMenu(&choix); - - } - - if (choix == 'Q') - { - //menuglobal() - return; - } + choix = ChoiceMenu(); + Loop(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, &choix, &insuf, place, nbacti); } + char Card(void)//demande si client a la carte { char bCard; @@ -177,6 +132,7 @@ void Name( char *nom, char *prenom)//demande nom et prénom + int FindData(char *nom, char *pnom, char tnom[][15], char tpnom[][15], int *tpasseoupas, int *tptsbought, char *action, int tmax) { int i, found = 0, testnom, testpnom; @@ -252,12 +208,7 @@ void Recharge(int *tptsbought, int place, char *tcateg) { int dizpts, topay, nbpts; printf("Combien de dizaines de points souhaitez-vous acheter ?\n"); - scanf("%d", &dizpts); - while (dizpts > 100 || dizpts < 0) - { - printf("Veuillez entrer un nombre correct de dizaines de points\n"); - scanf("%d", &dizpts); - } + scanf("%d%*c", &dizpts); if (tcateg[place] == 'E') { @@ -265,7 +216,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') @@ -274,7 +225,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') @@ -283,7 +234,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); } } @@ -294,8 +245,8 @@ int Acti(int i) { int acti; printf("Choix de l'activité %d: badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5) \n", i); - scanf("%*c%d%*c", &acti); - while (acti != 1 && acti != 2 && acti != 3 && acti != 4 && acti != 5) + scanf("%d%*c", &acti); + while (acti <= 0 && acti >= 6) { printf("Veuillez entrer un nombre d'activité correct (badminton (1) | football (2) | zumba (3) | musculation (4) | squash (5))\n"); scanf("%d%*c", &acti); @@ -335,15 +286,17 @@ int ChoiceActi(int nbacti, int *tacti) -void ChoiceMenu(char *choix) +int ChoiceMenu(void) { - printf("Recharge carte (R) | Afficher points (A) | Choix activités (C) | Quitter (Q)\n"); - scanf("%c%*c", choix); - while (*choix != 'R' && *choix != 'A' && *choix != 'C' && *choix != 'Q') + int choix; + printf("Recharge carte (1) | Afficher points (2) | Choix activités (3) | Quitter (4)\n"); + scanf("%d", &choix); + while (choix > 4 || choix < 1) { - printf("Entrer un caractère correct R | A | C | Q \n"); - scanf("%c%*c%*c", choix); + printf("Entrer un caractère correct 1 | 2 | 3 | 4 \n"); + scanf("%d%*c", &choix); } + return choix; } @@ -362,7 +315,7 @@ void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, cha if (ptsneeded <= tptsbought[place]) { ("Points suffisants, confirmation ? (O/N) \n"); - scanf("%c%*c", &confirm); + scanf("%*c%c%*c", &confirm); if (confirm == 'O') { tptsbought[place] -= ptsneeded; @@ -457,6 +410,54 @@ void Save(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, i +void Loop(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int *choix, int *insuf, int place, int nbacti) +{ + int chxacti; + char recharge; + while (*choix != 4) + { + + if (*choix == 2) + { + printf("La carte dispose de %d points.\n", tptsbought[place]);//infos sur ses points + } + + if (*choix == 1) + { + Recharge(tptsbought, place, tcateg); + } + + if (*choix == 3) + { + printf("Nombre d'activités souhaitées ? (max 3)\n"); + scanf("%*c%d", &nbacti); + while (nbacti < 0 || nbacti > 3) + { + printf("Nombre d'activités incorrect (max 3)\n"); + scanf("%*c%d", &nbacti); + } + + chxacti = ChoiceActi(nbacti, tacti); + CheckPts(tptsbonus, tptsbought, tpasseoupas, tacti, tcateg, place, chxacti, insuf); + if (*insuf == 1) + { + printf("Nombre de points insuffisants : Recharge (R) ou Quitter (Q)"); + scanf("%*c%c%*c", &recharge); + if (recharge == 'R') + { + Recharge(tptsbought, place, tcateg); + } + } + } + + *choix = ChoiceMenu(); + } +} + + + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -505,8 +506,8 @@ void fAffichage1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage,in if(noClient==-1) { return; - } - + } + } } printf(" N° Client\t Nom\t Prénom\t Age\t Tarif\t Nombre de points \t \n"); @@ -553,7 +554,7 @@ void cptAct(int *bad, int *muscu, int *foot, int *squa, int * zumba, int chx) } -//Calcul et affiche le nombre d'entrée +//Calcul et affiche le nombre d'entrée void affNbParAct(int *tacti, int tlog) { int chx1, chx2, chx3, bad, muscu, foot, squa, zumba, totbad, totmuscu, totfoot, totsqua, totzumba, i; @@ -678,12 +679,12 @@ void Index(void) int tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], place, nbacti, chxacti, numAd, ret, n, VSUIVANTE, next, choix=0; char tcateg[TAILLE], nom[TAILLE], pnom[TAILLE], fnom[TAILLE], fpnom[TAILLE], bCard, member, tnom[TAILLE][15], tpnom[TAILLE][15], action, retourmenu; - + n=Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500); FILE *fx; - + fx=fopen("x.don","r"); - + if (fx==NULL) {printf("erreur"); return;} @@ -693,7 +694,7 @@ void Index(void) while(!feof(fx)) { fscanf(fx, "%d", &next); - + if ( next> VSUIVANTE) { VSUIVANTE=next; @@ -713,7 +714,7 @@ void Index(void) //printf("\nTapez h pour une aide\n"); scanf("%d%*c", &choix); - + while (1 > choix || choix> 6) { printf("\nEntrez soit 1, soit 2.\t"); @@ -734,17 +735,17 @@ void Index(void) printf("\nTapez la lettre O pour revenir au menu.\t"); scanf("%*c%c%*c", &retourmenu); } - + if (retourmenu == 'O') Index(); - + } -*/ +*/ if (choix == 1) { creationCompte( &VSUIVANTE); } - + if (choix == 2) { menuAff(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500, n); @@ -764,26 +765,26 @@ void creationCompte(int *VSUIVANTE) FILE *fe, *fx, *fn; fe= fopen("donneClient.don", "a"); fx= fopen("x.don","a"); - - + + if (fe==NULL) { printf(" Erreur ouverture fichier"); } - + printf("\nEntrez votre nom\n"); scanf("%s%*c", nom); - + printf("\nEntrez votre prenom\n"); scanf("%s%*c", prenom); - + printf("\nEntrez votre age\n"); scanf("%d%*c", &age); - + printf("Avez-vous un tarif spécial: Etudiant(E), Senior(S), aucun(A)?\n"); scanf("%c%*c", &categorie); - - + + fprintf(fe,"\n%d\t",*VSUIVANTE); fprintf(fe,"%s\t",nom); fprintf(fe,"%s\t",prenom); @@ -798,17 +799,17 @@ void creationCompte(int *VSUIVANTE) *VSUIVANTE=*VSUIVANTE+1; fprintf(fx,"\n%d",*VSUIVANTE); - + printf("Ajoutez un contact?(O/N)\n"); scanf("%c%*c", &retour); - + if (retour == 'O') creationCompte(VSUIVANTE); else return; } - + void menuAff (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 choix, noClient; @@ -825,4 +826,3 @@ void menuAff (int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstat fAffichage1Client(tAd, tnom, tpnom, tage, tstate, n, noClient, tptsbought, tcateg); } } - diff --git a/hCommun.h b/hCommun.h index 42674cc..d1165ac 100644 --- a/hCommun.h +++ b/hCommun.h @@ -7,7 +7,7 @@ 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); -char Card(void);//check si le client a la carte +char Card(void);//check si le client a la carte void Index(void); void creationCompte(int *VSUIVANTE); void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang); @@ -22,4 +22,5 @@ int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf); void GereAdhérent(void); void Save(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 place); +void Loop(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int *choix, int *insuf, int place, int nbacti); void menuAff (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); From c7b7729a23884fe0acbf2ee46db16f537a6741a1 Mon Sep 17 00:00:00 2001 From: L0ol4X Date: Fri, 11 Nov 2022 11:23:07 +0100 Subject: [PATCH 12/13] modif .h --- hCommun.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hCommun.h b/hCommun.h index d1165ac..6323563 100644 --- a/hCommun.h +++ b/hCommun.h @@ -16,7 +16,7 @@ int FindData(char *nom, char *prenom, char tnom[][15], char tpnom[][15], int *tp void Recharge(int *tptsbought, int place, char *tcateg); int ChoiceActi(int nbacti, int *tacti); int Acti(int i); -void ChoiceMenu(char *choix); +int ChoiceMenu(void); int CheckActi(int nb); int FindN(int *tAd, int numAd, int *tpasseoupas, int tmax); void CheckPts(int *tptsbonus, int *tptsbought, int *tpasseoupas, int *tacti, char *tcateg, int place, int acti, int *insuf); From c554bacfb7f73dc96a2f05e2c06597f6db5f5091 Mon Sep 17 00:00:00 2001 From: L0ol4X Date: Fri, 11 Nov 2022 11:31:36 +0100 Subject: [PATCH 13/13] change main() to Index() --- commun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commun.c b/commun.c index ae345bd..98c5e1c 100644 --- a/commun.c +++ b/commun.c @@ -100,7 +100,7 @@ void GereAdhérent(void) ret = FindN(tAd, numAd, tpasseoupas, 500); if (ret == -1) { - main(); + Index(); } } @@ -417,7 +417,7 @@ void Loop(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, i while (*choix != 4) { - if (*choix == 2) + if (*choix == 2) { printf("La carte dispose de %d points.\n", tptsbought[place]);//infos sur ses points }