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