commit
96465a1791
@ -1,3 +1,3 @@
|
|||||||
232665 Belbe Francis 12 0 0 1 12 23 A
|
232665 Belbe Francis 12 0 0 1 12 23 A
|
||||||
256322 Patrick patricia 44 1 2 0 23 36 E
|
256322 Patrick patricia 44 0 2 0 23 36 E
|
||||||
254899 Asis Bichette 55 0 3 0 1 55 C
|
254899 Asis Bichette 55 0 3 0 1 55 C
|
@ -1,4 +1,4 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
void menu (void);
|
void menu ();
|
||||||
void creationCompte(int *VSUIVANTE);
|
void creationCompte(int *VSUIVANTE);
|
||||||
void c(void);
|
void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang);
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "evsae.h"
|
#include "hCommun.h"
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
//c();
|
int pos, tAd[TAILLE], tage[TAILLE], tstate[TAILLE], tacti[TAILLE], tpasseoupas[TAILLE], tptsbought[TAILLE], tptsbonus[TAILLE], n;
|
||||||
menu();
|
char tnom[TAILLE][15], tpnom[TAILLE][15],tcateg[TAILLE];
|
||||||
|
pos = Fillvar(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500);
|
||||||
|
Index(&pos,tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, 500);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define TAILLE 500
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
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 )
|
|
||||||
|
|
||||||
|
@ -1,14 +1,28 @@
|
|||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
// .h Roxane
|
#define TAILLE 500
|
||||||
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 )
|
|
||||||
|
|
||||||
//.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);
|
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 *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int noClient, int tmax);
|
||||||
|
void affNbmEntree(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int tmax);
|
||||||
|
void cptAct(int *bad, int *muscu, int *foot, int *squa, int * zumba, int chx);
|
||||||
|
void affNbParAct(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int tmax);
|
||||||
|
void suppr1Client(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int *n, int tmax);
|
||||||
char Card(void);//check si le client a la carte
|
char Card(void);//check si le client a la carte
|
||||||
|
void creationCompte(int *VSUIVANTE,int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int tmax);
|
||||||
|
void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang);
|
||||||
void Name( char *nom, char *prenom);
|
void Name( char *nom, char *prenom);
|
||||||
void scanNandP(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);
|
||||||
|
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 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);
|
||||||
|
void afficheTous (int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg,int n, int tmax);
|
||||||
|
void changementEtatCarte ( int nclient ,int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int tmax, int n);
|
||||||
|
void Index(int *n, int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int tmax);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,414 @@
|
|||||||
|
#include "sae.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
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%*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;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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%*c", &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("%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);
|
||||||
|
}
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbacti == 3)
|
||||||
|
{
|
||||||
|
chx1 = Acti(nbacti-2);
|
||||||
|
chx2 = Acti(nbacti-1);
|
||||||
|
chx3 = Acti(nbacti);
|
||||||
|
chxacti = chx1 + chx2*10 + chx3*100;
|
||||||
|
}
|
||||||
|
return chxacti;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int ChoiceMenu(void)
|
||||||
|
{
|
||||||
|
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 1 | 2 | 3 | 4 \n");
|
||||||
|
scanf("%d%*c", &choix);
|
||||||
|
}
|
||||||
|
return 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])
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
#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);
|
||||||
|
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);
|
||||||
|
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);
|
@ -1,72 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
@ -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);
|
|
@ -1,13 +1,20 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include "fRox.h"
|
#include "fRox.h"
|
||||||
|
|
||||||
|
|
||||||
void main(void)
|
int main(void)
|
||||||
{ int *tNoClient, *tAge, toto, *tCActiv, *tActivite, *tPtsBought, *tPtsBonus;
|
{ char nom[15], prenom[15], fnom[15], fprenom[15], bCard, member, categ, recharge, acti1[15], acti2[15], acti3[15];
|
||||||
char *tNomClient, *tPreClient, *tCat;
|
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;
|
||||||
|
|
||||||
toto =fchargement(tNoClient, tNomClient, tPreClient, tAge, tCActiv, tActivite, tActivite, tPtsBought, tPtsBonus, tCat, 500);
|
FILE *f;
|
||||||
printf("%d\n", toto);
|
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;
|
||||||
}
|
}
|
||||||
|
@ -1,946 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#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;
|
|
||||||
}
|
|
@ -0,0 +1,54 @@
|
|||||||
|
#include "sae.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
main();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
choix = ChoiceMenu();
|
||||||
|
Loop(tAd, tnom, tpnom, tage, tstate, tacti, tpasseoupas, tptsbought, tptsbonus, tcateg, &choix, &insuf, place, nbacti);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (choix == 4)
|
||||||
|
{
|
||||||
|
//menuglobal()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*while (choix != 4)
|
||||||
|
{
|
||||||
|
choix =ChoiceMenu();
|
||||||
|
}*/
|
||||||
|
}
|
Loading…
Reference in new issue