parent
e37e91d049
commit
110e595c64
@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
3 Abrial Evann 18 0 0 0 E
|
|
||||||
4 Fingen Trop 56 0 0 0 A
|
|
||||||
5 jcdik ijsfk 12 0 0 0 E
|
|
||||||
5 Came Casselescouilles 56 0 0 0 30 0 E
|
|
||||||
6 Jean Edouard 78 0 0 0 30 0 S
|
|
@ -1,400 +0,0 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "evsae.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
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("\nLA VALEUR DE VALEURSUIVANTE: %d",VSUIVANTE);
|
|
||||||
|
|
||||||
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", &choix);
|
|
||||||
|
|
||||||
while ( choix != 'h' && choix != '1' && choix != '2')
|
|
||||||
{
|
|
||||||
printf("\nEntrez soit h, soit 1, soit 2.\t");
|
|
||||||
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<x; i++)
|
|
||||||
{
|
|
||||||
fprintf(fe,"\n%d",i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Compte(void)
|
|
||||||
{
|
|
||||||
printf("Entrez votre numéro de carte");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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é passé ou pas
|
|
||||||
fprintf(fe, "0\t"); //point acheté
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=======
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "evsae.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
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 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 fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang)
|
|
||||||
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
if(tAd[i] == noClient)
|
|
||||||
{
|
|
||||||
*coderet = 1;
|
|
||||||
|
|
||||||
*rang = i;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tAd[i] > noClient)
|
|
||||||
|
|
||||||
*rang = i;
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
void changementEtatCarte ( int *tAd , int *tstate, int n, nclient)
|
|
||||||
{
|
|
||||||
int nchoix, coderet, pos
|
|
||||||
|
|
||||||
printf("\nNouvel état de la carte:");
|
|
||||||
|
|
||||||
printf("\nDésactiver(0)")
|
|
||||||
printf("\nActiver(1)")
|
|
||||||
|
|
||||||
scanf("%c%*c",&nchoix
|
|
||||||
|
|
||||||
if (nchoix == 0)
|
|
||||||
{
|
|
||||||
fRecherche(tAd, n, nclient, &coderet, &rang);
|
|
||||||
tAD[6]= 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nchoix == 1)
|
|
||||||
{
|
|
||||||
fRecherche(tAd, n, nclient, &coderet, &rang);
|
|
||||||
tAD[6]= 0
|
|
||||||
}
|
|
||||||
|
|
||||||
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 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
>>>>>>> c554bacfb7f73dc96a2f05e2c06597f6db5f5091
|
|
@ -1,4 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
void menu ();
|
|
||||||
void creationCompte(int *VSUIVANTE);
|
|
||||||
void fRecherche(int *tAd, int n, int noClient, int *coderet, int *rang);
|
|
@ -1,273 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include "fRox.h"
|
|
||||||
#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
|
|
||||||
{
|
|
||||||
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 *tAd, int n, int noClient, int *coderet, int *rang)
|
|
||||||
{
|
|
||||||
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 *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int n, int noClient )
|
|
||||||
{
|
|
||||||
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 *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, nbentre;
|
|
||||||
for( i=0 ; i<tlog ; i++)
|
|
||||||
(if( tpasseoupas[i]==1 )
|
|
||||||
nbentre += 1;)
|
|
||||||
printf( "Le nombre d'entrée totale de la journée s'élève a : %d\n", nbentre)
|
|
||||||
return nbentre;
|
|
||||||
}
|
|
||||||
// fonction comptage activité
|
|
||||||
void cptAct(int *bad, int *muscu, int *foot, int *squa, int * zumba, int chx)
|
|
||||||
{
|
|
||||||
if ( chx == 1)
|
|
||||||
*bad += 1;
|
|
||||||
if ( chx == 2)
|
|
||||||
*muscu += 1;
|
|
||||||
if ( chx == 3)
|
|
||||||
*foot += 1;
|
|
||||||
if ( chx == 4)
|
|
||||||
*squa += 1;
|
|
||||||
if ( chx == 5)
|
|
||||||
*zumba += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//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;
|
|
||||||
|
|
||||||
for( i=0; i<tlog ; i++)
|
|
||||||
(chx1 = tacti[i]/100;
|
|
||||||
chx2 = (tacti[i]%100)/10;
|
|
||||||
chx3 = chx2%10;)
|
|
||||||
if ( chx1 != 0 )
|
|
||||||
cptAct( &bad, &muscu, &foot, &squa, &zumba, chx1);
|
|
||||||
totbad = bad;
|
|
||||||
totmuscu = muscu;
|
|
||||||
totfoot = foot;
|
|
||||||
totsqua = squa;
|
|
||||||
totzumba = zumba;
|
|
||||||
if ( chx2 != 0 )
|
|
||||||
cptAct( &bad, &muscu, &foot, &squa, &zumba, chx2);
|
|
||||||
totbad = bad + totbad;
|
|
||||||
totmuscu = muscu + totmuscu;
|
|
||||||
totfoot = foot + totfoot;
|
|
||||||
totsqua = squa + totsqua;
|
|
||||||
totzumba = zumba + totzumba;
|
|
||||||
if ( chx3 != 0 )
|
|
||||||
cptAct( &bad, &muscu, &foot, &squa, &zumba, chx3);
|
|
||||||
totbad = bad + totbad;
|
|
||||||
totmuscu = muscu + totmuscu;
|
|
||||||
totfoot = foot + totfoot;
|
|
||||||
totsqua = squa + totsqua;
|
|
||||||
totzumba = zumba + totzumba;
|
|
||||||
If ( chx1 == 0 && chx2 == 0 && chx3 == 0)
|
|
||||||
(printf("Pas d'activité pour le moment")
|
|
||||||
return;
|
|
||||||
)
|
|
||||||
|
|
||||||
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;}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#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);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,414 +0,0 @@
|
|||||||
#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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
#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,54 +0,0 @@
|
|||||||
#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