|
|
@ -32,7 +32,7 @@ int ajoutClient (void)
|
|
|
|
while(numeroclient==verif)
|
|
|
|
while(numeroclient==verif)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("le numéro client existe déja ,veuillez ressaissir\n");
|
|
|
|
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;
|
|
|
|
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);
|
|
|
|
fclose(fichierclient);
|
|
|
|
printf("client ajouté au programme de fidélité ! \n");
|
|
|
|
printf("client ajouté au programme de fidélité ! \n");
|
|
|
|
return numeroclient;
|
|
|
|
return numeroclient;
|
|
|
@ -61,7 +61,7 @@ int supensioncarte (void)
|
|
|
|
float tabCAG [100]={0};
|
|
|
|
float tabCAG [100]={0};
|
|
|
|
int tabSUS [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;
|
|
|
|
float cagnotte;
|
|
|
|
|
|
|
|
|
|
|
|
FILE *fichierClientmegacool;
|
|
|
|
FILE *fichierClientmegacool;
|
|
|
@ -103,11 +103,21 @@ int supensioncarte (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (tabNC[compteur]==recherche)
|
|
|
|
if (tabNC[compteur]==recherche)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
compteur=rapportcagnotte;
|
|
|
|
compteurCAG=compteur;
|
|
|
|
|
|
|
|
|
|
|
|
printf("l'état de la carte de ce client est %d\n",tabSUS[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");
|
|
|
|
printf("modifiez l'état (0 pour non suspendu) (1 pour suspendu)\n");
|
|
|
|
scanf("%d",&sus);
|
|
|
|
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;
|
|
|
|
tabSUS[compteur]=sus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -120,53 +130,67 @@ int supensioncarte (void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (tabSUS[rapportcagnotte]==1)
|
|
|
|
if (tabSUS[compteurCAG]==1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("création d'une nouvelle carte pour le client %d",tabNC[compteur]);
|
|
|
|
printf("création d'une nouvelle carte pour le client %d\n",tabNC[compteurCAG]);
|
|
|
|
|
|
|
|
|
|
|
|
nc=ajoutClient();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recherche=nc;
|
|
|
|
printf("numéro de la nouvelle carte ?\n");
|
|
|
|
|
|
|
|
scanf("%d",&nouvellecarte);
|
|
|
|
|
|
|
|
|
|
|
|
for (compteur=0;compteur<n;compteur++)
|
|
|
|
for (compteur=0;compteur<n;compteur++)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (tabNC[n+1]==tabNC[compteur])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (tabNC[compteur]==recherche)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tabCAG[compteur]=rapportcagnotte;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compteur=compteur+1;
|
|
|
|
printf("le client existe déja, ressaisissez\n");
|
|
|
|
|
|
|
|
scanf("%d",&nouvellecarte);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (compteur>n)
|
|
|
|
while(nouvellecarte<0);
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("le client n'existe pas\n");
|
|
|
|
printf("ne peut étre négatif\n");
|
|
|
|
return -2;
|
|
|
|
scanf("%d",&nouvellecarte);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tabNC[n+1]=nouvellecarte;
|
|
|
|
|
|
|
|
tabCAG[n+1]=tabCAG[compteurCAG];
|
|
|
|
|
|
|
|
tabSUS[n+1]=sus;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (compteur=0;compteur<n;compteur++)
|
|
|
|
for (compteur=0;compteur<n;compteur++)
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(fichierClientmegacool, "\t%d\t%*.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabSUS[compteur]);
|
|
|
|
fprintf(fichierClientmegacool, "%d\t%*.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabSUS[compteur]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
|
|
|
|
|
|
|
printf("youpi di skoop état de suspension modifié et nouveau compte créé !\n");
|
|
|
|
printf("état de suspension modifié !\n");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (compteur=0;compteur<n;compteur++)
|
|
|
|
for (compteur=0;compteur<n;compteur++)
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(fichierClientmegacool, "\t%d\t%*.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabSUS[compteur]);
|
|
|
|
fprintf(fichierClientmegacool, "%d\t%*.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabSUS[compteur]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (compteur=0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("fichier vide");
|
|
|
|
|
|
|
|
return -2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("youpi di skoop état de suspension modifié et nouveau compte créé !\n");
|
|
|
|
printf("état de suspension modifié !\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -192,3 +216,5 @@ int compteurtaillelogique (void)
|
|
|
|
return i;
|
|
|
|
return i;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//fix les probléme de négativités
|