From 54e550680f6d0cf11c479fc817a395ef1912d568 Mon Sep 17 00:00:00 2001 From: "evann.abrial" Date: Fri, 11 Nov 2022 13:52:46 +0100 Subject: [PATCH] Fonction perso --- donneClient.don | 5 ++++ evsae.c | 59 +++++++++++++++++++++++++++++--------- evtestsae.h => evtestsae.c | 4 +-- x.don | 8 +++++- 4 files changed, 60 insertions(+), 16 deletions(-) rename evtestsae.h => evtestsae.c (69%) diff --git a/donneClient.don b/donneClient.don index e69de29..9c010e5 100644 --- a/donneClient.don +++ b/donneClient.don @@ -0,0 +1,5 @@ + + +3 Abrial Evann 18 0 0 0 E +4 Fingen Trop 56 0 0 0 A +5 jcdik ijsfk 12 0 0 0 E \ No newline at end of file diff --git a/evsae.c b/evsae.c index bd5c78e..3d44b1d 100644 --- a/evsae.c +++ b/evsae.c @@ -1,30 +1,47 @@ #include -#include "sae.h" +#include "evsae.h" #include void menu (void) { char choix, retourmenu; - int VSUIVANTE; + int VSUIVANTE, next; FILE *fx; fx=fopen("x.don","r"); + if (fx==NULL) {printf("erreur"); return;} - - - while(feof(fx)) + + VSUIVANTE=0; + + while(!feof(fx)) { - fscanf(fx,"%d",&VSUIVANTE); + 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"); @@ -49,8 +66,11 @@ void menu (void) printf("gogogogo"); //Compte() } + } + +/* void c(void) { int x=10000000, i=0; @@ -62,7 +82,15 @@ void c(void) fprintf(fe,"\n%d",i); } } - + +*/ + +void Compte(void) + { + printf("Entrez votre numéro de carte"); + } + + void creationCompte(int *VSUIVANTE) { @@ -70,10 +98,8 @@ void creationCompte(int *VSUIVANTE) int age, nclient; FILE *fe, *fx, *fn; fe= fopen("donneClient.don", "a"); - fn= fopen("nclient.don", "r"); fx= fopen("x.don","a"); - fprintf(fx,"%d", *VSUIVANTE); if (fe==NULL) { @@ -93,17 +119,24 @@ void creationCompte(int *VSUIVANTE) scanf("%c%*c", &categorie); - fprintf(fe,"%d\t",*VSUIVANTE); + fprintf(fe,"\n%d\t",*VSUIVANTE); fprintf(fe,"%s\t",nom); fprintf(fe,"%s\t",prenom); fprintf(fe,"%d\t",age); - fprintf(fe,"%c\n",categorie); + 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("Retour menu?(O/N)\n"); + printf("Ajoutez un contact?(O/N)\n"); scanf("%c%*c", &retour); if (retour == 'O') - menu(); + creationCompte(VSUIVANTE); else return; } diff --git a/evtestsae.h b/evtestsae.c similarity index 69% rename from evtestsae.h rename to evtestsae.c index 650d567..3c39ed0 100644 --- a/evtestsae.h +++ b/evtestsae.c @@ -1,9 +1,9 @@ #include -#include "sae.h" +#include "evsae.h" int main (void) { - c(); + //c(); menu(); return 0; } diff --git a/x.don b/x.don index 7fdf52a..8d1da4a 100644 --- a/x.don +++ b/x.don @@ -1,2 +1,8 @@ 0 --2091757392-2091757392-2085961056 \ No newline at end of file +1 +1 +2 +3 +4 +5 +6 \ No newline at end of file