diff --git a/FICHIERCYRIAQUE/ajoutClient.c b/FICHIERCYRIAQUE/ajoutClient.c index 55b5c53..6743700 100644 --- a/FICHIERCYRIAQUE/ajoutClient.c +++ b/FICHIERCYRIAQUE/ajoutClient.c @@ -32,7 +32,7 @@ int ajoutClient (void) while(numeroclient==verif) { printf("le numéro client existe déja ,veuillez ressaissir\n"); - scanf("%*c%d",&numeroclient); + scanf("%d",&numeroclient); } } @@ -47,7 +47,7 @@ int ajoutClient (void) return -2; } - fprintf(fichierclient,"\t%d\t%*.2f\t%d\n",numeroclient,100,0); + fprintf(fichierclient,"%d\t%*.2f\t%d\n",numeroclient,100,0); fclose(fichierclient); printf("client ajouté au programme de fidélité ! \n"); return numeroclient; @@ -61,7 +61,7 @@ int supensioncarte (void) float tabCAG [100]={0}; int tabSUS [100]={0}; - int nc,sus,compteur=0,rapportcagnotte,taillemax=100,recherche,n; + int nc,nouvellecarte,sus,compteur=0,compteurCAG,taillemax=100,recherche,n; float cagnotte; FILE *fichierClientmegacool; @@ -103,11 +103,21 @@ int supensioncarte (void) { if (tabNC[compteur]==recherche) { - compteur=rapportcagnotte; + compteurCAG=compteur; printf("l'état de la carte de ce client est %d\n",tabSUS[compteur]); printf("modifiez l'état (0 pour non suspendu) (1 pour suspendu)\n"); scanf("%d",&sus); + while (sus!=1 && sus !=0) + { + printf("état de suspension non valide , retapez.\n"); + scanf("%d",&sus); + } + if (tabSUS[compteur]==sus) + { + printf("état de suspension est déja de %d\n",sus); + return -4; + } tabSUS[compteur]=sus; } @@ -120,54 +130,68 @@ int supensioncarte (void) } } - if (tabSUS[rapportcagnotte]==1) + if (tabSUS[compteurCAG]==1) { - printf("création d'une nouvelle carte pour le client %d",tabNC[compteur]); - - nc=ajoutClient(); + printf("création d'une nouvelle carte pour le client %d\n",tabNC[compteurCAG]); - recherche=nc; + printf("numéro de la nouvelle carte ?\n"); + scanf("%d",&nouvellecarte); for (compteur=0;compteurn) - { - printf("le client n'existe pas\n"); - return -2; - } - } + + tabNC[n+1]=nouvellecarte; + tabCAG[n+1]=tabCAG[compteurCAG]; + tabSUS[n+1]=sus; + for (compteur=0;compteur