Roxane ROSSETTO 2 years ago
commit a063a3770a

@ -1,29 +1,44 @@
#include <stdio.h> #include <stdio.h>
#include "sae.h" #include "evsae.h"
#include <stdlib.h> #include <stdlib.h>
void menu (void) void menu (void)
{ {
char choix, retourmenu; char choix, retourmenu;
int VSUIVANTE; int VSUIVANTE, next;
FILE *fx; FILE *fx;
fx=fopen("x.don","r"); fx=fopen("x.don","r");
if (fx==NULL) if (fx==NULL)
{printf("erreur"); {printf("erreur");
return;} return;}
VSUIVANTE=0;
while(feof(fx)) while(!feof(fx))
{ {
fscanf(fx,"%d",&VSUIVANTE); fscanf(fx, "%d", &next);
if ( next> VSUIVANTE)
{
VSUIVANTE=next;
}
} }
printf("\nQue souhaitez vous faire?\n"); printf("\nQue souhaitez vous faire?\n");
printf("\n1- Créer un compte\n"); printf("\n1- Créer un compte\n");
printf("2- Presenter sa carte\n"); printf("2- Presenter sa carte\n");
printf("Controle C pour quitter");
printf("\nTapez h pour une aide\n"); printf("\nTapez h pour une aide\n");
scanf("%c%*c", &choix);
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') if (choix == 'h')
{ {
@ -32,11 +47,17 @@ void menu (void)
printf("Tapez le nombre au début de la liste des fonctionnalitées pour y accéder"); 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("\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"); printf("\nTapez O pour retourner au menu principal\n");
scanf("%c%*c",&retourmenu); scanf("%c",&retourmenu);
if (retourmenu == 'O') while ( retourmenu != 'O')
{
printf("\nTapez la lettre O pour revenir au menu.\t");
scanf("%*c%c%*c", &retourmenu);
}
if (retourmenu == 'O')
menu(); menu();
} }
if (choix == '1') if (choix == '1')
@ -49,8 +70,11 @@ void menu (void)
printf("gogogogo"); printf("gogogogo");
//Compte() //Compte()
} }
} }
/*
void c(void) void c(void)
{ {
int x=10000000, i=0; int x=10000000, i=0;
@ -63,6 +87,7 @@ void c(void)
} }
} }
*/
void creationCompte(int *VSUIVANTE) void creationCompte(int *VSUIVANTE)
{ {
@ -70,10 +95,8 @@ void creationCompte(int *VSUIVANTE)
int age, nclient; int age, nclient;
FILE *fe, *fx, *fn; FILE *fe, *fx, *fn;
fe= fopen("donneClient.don", "a"); fe= fopen("donneClient.don", "a");
fn= fopen("nclient.don", "r");
fx= fopen("x.don","a"); fx= fopen("x.don","a");
fprintf(fx,"%d", *VSUIVANTE);
if (fe==NULL) if (fe==NULL)
{ {
@ -93,24 +116,74 @@ void creationCompte(int *VSUIVANTE)
scanf("%c%*c", &categorie); scanf("%c%*c", &categorie);
fprintf(fe,"%d\t",*VSUIVANTE); fprintf(fe,"\n%d\t",*VSUIVANTE);
fprintf(fe,"%s\t",nom); fprintf(fe,"%s\t",nom);
fprintf(fe,"%s\t",prenom); fprintf(fe,"%s\t",prenom);
fprintf(fe,"%d\t",age); fprintf(fe,"%d\t",age);
fprintf(fe,"%c\n",categorie); 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;
printf("Retour menu?(O/N)\n"); fprintf(fx,"\n%d",*VSUIVANTE);
printf("Ajoutez un contact?(O/N)\n");
scanf("%c%*c", &retour); scanf("%c%*c", &retour);
if (retour == 'O') if (retour == 'O')
menu(); creationCompte(VSUIVANTE);
else else
return; 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 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)")
}

@ -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,9 @@
#include <stdio.h> #include <stdio.h>
#include "sae.h" #include "evsae.h"
int main (void) int main (void)
{ {
c(); //c();
menu(); menu();
return 0; return 0;
} }

10000001
nclient.don

File diff suppressed because it is too large Load Diff

BIN
test

Binary file not shown.

@ -1,2 +1,8 @@
0 0
-2091757392-2091757392-2085961056 1
1
2
3
4
5
6
Loading…
Cancel
Save