ajout fonction affichage solo

master
cyriaque.segerie 2 years ago
parent bfec3a7ed9
commit 1236c4b1bf

@ -12,9 +12,10 @@ int modifclientglobal (void)
while(choix!=9)
{
n=compteurtaillelogique();
printf("Appuyez sur '1' pour ajouter un client,\nsur '2' pour changer l'état de suspension d'une carte client,\nsur '3' pour supprimer un client ,\nsur '4' pour afficher le fichier client,\nOu sur '9' pour sortir du programme !\n");
printf("\n");
printf("Appuyez sur '1' pour ajouter un client,\nsur '2' pour changer l'état de suspension d'une carte client,\nsur '3' pour supprimer un client ,\nsur '4' pour afficher le fichier client,\nsur '5' pour chercher un seul client dans le fichier,\nOu sur '9' pour sortir du programme !\n");
scanf("%d",&choix);
while (choix!=1 && choix!=2 && choix!=3 && choix!=4 && choix!=9)
while (choix!=1 && choix!=2 && choix!=3 && choix!=4 && choix!=5 && choix!=9)
{
printf("Entrée incorrect, veuillez ressasisir.\n");
scanf("%d",&choix);
@ -36,7 +37,11 @@ int modifclientglobal (void)
if (choix==4)
{
coderreur=affichage();
coderreur=affichageall();
}
if (choix==5)
{
coderreur=affichagesolo();
}
}
@ -335,9 +340,9 @@ int supressionclient (int *n)
}
int affichage (void)
int affichageall (void)
{
int compteur,nc,suspension;
int nc,suspension;
float cagnotte;
FILE *flot;
@ -357,6 +362,31 @@ int affichage (void)
return 0;
}
int affichagesolo (void)
{
int rechercher,nc,suspension;
float cagnotte;
FILE *flot;
flot=fopen("fichierclient.don","r");
if (flot==NULL)
{
printf("erreur d'ouverture du fichier\n");
return -1;
}
printf("quel client recherchez vous ?\n");
scanf("%d",&rechercher);
fscanf(flot,"%d%f%d",&nc,&cagnotte,&suspension);
while (feof(flot)==0)
{
if (nc==rechercher)
printf("%d\t%.2f\t%d\n",nc,cagnotte,suspension);
fscanf(flot,"%d%f%d",&nc,&cagnotte,&suspension);
}
fclose(flot);
return 0;
}
int creationfichier(void)
{
FILE *flot;

@ -1,2 +1,8 @@
12 0.00 0
75 0.00 0
84 0.00 0
213 0.00 0
48 0.00 0
402 0.00 0
14 0.00 0
22000 0.00 0

Binary file not shown.

@ -5,5 +5,6 @@ int ajoutClient (void);
int suspensioncarte (int *n);
int compteurtaillelogique (void);
int supressionclient (int *n);
int affichage (void);
int affichagesolo (void);
int affichageall (void);
int creationfichier(void);

Loading…
Cancel
Save