Fonction perso

master
evann.abrial 2 years ago
parent 3d34654bd3
commit 54e550680f

@ -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

@ -1,30 +1,47 @@
#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))
{
fscanf(fx, "%d", &next);
while(feof(fx)) if ( next> VSUIVANTE)
{ {
fscanf(fx,"%d",&VSUIVANTE); VSUIVANTE=next;
} }
}
printf("\nLA VALEUR DE VALEURSUIVANTE: %d",VSUIVANTE);
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", &choix);
while ( choix != 'h' && choix != '1' && choix != '2')
{
printf("\nEntrez soit h, soit 1, soit 2.\t");
scanf("%c%*c", &choix);
}
if (choix == 'h') if (choix == 'h')
{ {
printf("\n\tBienvenue dans notre application!\n"); printf("\n\tBienvenue dans notre application!\n");
@ -49,8 +66,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 +83,14 @@ void c(void)
} }
} }
*/
void Compte(void)
{
printf("Entrez votre numéro de carte");
}
void creationCompte(int *VSUIVANTE) void creationCompte(int *VSUIVANTE)
{ {
@ -70,10 +98,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,17 +119,24 @@ 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é passé ou pas
fprintf(fe, "0\t"); //point acheté
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;
} }

@ -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;
} }

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