|
|
|
@ -324,18 +324,18 @@ int suspensioncarte (int *n)
|
|
|
|
|
int nc,nouvellecarte,suspension,compteur=0,compteurCAG,taillemax=100,recherche;
|
|
|
|
|
float cagnotte;
|
|
|
|
|
|
|
|
|
|
FILE *fichierClientmegacool;
|
|
|
|
|
FILE *fichierclients;
|
|
|
|
|
|
|
|
|
|
fichierClientmegacool=fopen("fichierclient.don","r");
|
|
|
|
|
if (fichierClientmegacool==NULL)
|
|
|
|
|
fichierclients=fopen("fichierclient.don","r");
|
|
|
|
|
if (fichierclients==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("Probléme d'ouverture");
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fscanf(fichierClientmegacool,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
while (feof(fichierClientmegacool)==0)
|
|
|
|
|
fscanf(fichierclients,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
while (feof(fichierclients)==0)
|
|
|
|
|
{
|
|
|
|
|
if (compteur>*n)
|
|
|
|
|
{
|
|
|
|
@ -346,9 +346,9 @@ int suspensioncarte (int *n)
|
|
|
|
|
tabCAG[compteur]=cagnotte;
|
|
|
|
|
tabsuspension[compteur]=suspension;
|
|
|
|
|
compteur=compteur+1;
|
|
|
|
|
fscanf(fichierClientmegacool,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
fscanf(fichierclients,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
}
|
|
|
|
|
fclose (fichierClientmegacool);
|
|
|
|
|
fclose (fichierclients);
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("quel carte souhaitez vous suspendre ou désuspendre (entrez numéro client)\n");
|
|
|
|
|
scanf("%d",&recherche);
|
|
|
|
@ -421,8 +421,8 @@ int suspensioncarte (int *n)
|
|
|
|
|
return -5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fichierClientmegacool=fopen("fichierclient.don","w");
|
|
|
|
|
if (fichierClientmegacool==NULL)
|
|
|
|
|
fichierclients=fopen("fichierclient.don","w");
|
|
|
|
|
if (fichierclients==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Probléme d'ouverture");
|
|
|
|
|
return -2;
|
|
|
|
@ -430,21 +430,21 @@ int suspensioncarte (int *n)
|
|
|
|
|
|
|
|
|
|
for (compteur=0;compteur<(*n-1);compteur++)
|
|
|
|
|
|
|
|
|
|
fprintf(fichierClientmegacool, "%d\t%.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabsuspension[compteur]);
|
|
|
|
|
fprintf(fichierclients, "%d\t%.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabsuspension[compteur]);
|
|
|
|
|
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
fclose(fichierclients);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fichierClientmegacool=fopen("fichierclient.don","a");
|
|
|
|
|
if (fichierClientmegacool==NULL)
|
|
|
|
|
fichierclients=fopen("fichierclient.don","a");
|
|
|
|
|
if (fichierclients==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Probléme d'ouverture");
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(fichierClientmegacool, "%d\t%.2f\t%d\n",nouvellecarte,tabCAG[compteurCAG],0);
|
|
|
|
|
fprintf(fichierclients, "%d\t%.2f\t%d\n",nouvellecarte,tabCAG[compteurCAG],0);
|
|
|
|
|
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
fclose(fichierclients);
|
|
|
|
|
|
|
|
|
|
printf("état de suspension modifié !\n");
|
|
|
|
|
|
|
|
|
@ -452,8 +452,8 @@ int suspensioncarte (int *n)
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fichierClientmegacool=fopen("fichierclient.don","w");
|
|
|
|
|
if (fichierClientmegacool==NULL)
|
|
|
|
|
fichierclients=fopen("fichierclient.don","w");
|
|
|
|
|
if (fichierclients==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Probléme d'ouverture");
|
|
|
|
|
return -2;
|
|
|
|
@ -461,9 +461,9 @@ int suspensioncarte (int *n)
|
|
|
|
|
|
|
|
|
|
for (compteur=0;compteur<*n;compteur++)
|
|
|
|
|
|
|
|
|
|
fprintf(fichierClientmegacool, "%d\t%.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabsuspension[compteur]);
|
|
|
|
|
fprintf(fichierclients, "%d\t%.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabsuspension[compteur]);
|
|
|
|
|
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
fclose(fichierclients);
|
|
|
|
|
|
|
|
|
|
if (compteur=0)
|
|
|
|
|
{
|
|
|
|
@ -487,7 +487,7 @@ int supressionclient (int *n)
|
|
|
|
|
int nc,suspension,compteur=0,taillemax=100,recherche2,nt=1;
|
|
|
|
|
float cagnotte;
|
|
|
|
|
|
|
|
|
|
FILE *fichierClientmegacool;
|
|
|
|
|
FILE *fichierclients;
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf("quel est le numéro du client que vous souhaitez supprimer ?\n");
|
|
|
|
|
scanf("%d",&recherche2);
|
|
|
|
@ -495,15 +495,15 @@ int supressionclient (int *n)
|
|
|
|
|
printf("ne peut étre négatif\n");
|
|
|
|
|
scanf("%d",&recherche2);
|
|
|
|
|
}
|
|
|
|
|
fichierClientmegacool=fopen("fichierclient.don","r");
|
|
|
|
|
if (fichierClientmegacool==NULL)
|
|
|
|
|
fichierclients=fopen("fichierclient.don","r");
|
|
|
|
|
if (fichierclients==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Probléme d'ouverture");
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fscanf(fichierClientmegacool,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
while(feof(fichierClientmegacool)==0)
|
|
|
|
|
fscanf(fichierclients,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
while(feof(fichierclients)==0)
|
|
|
|
|
{
|
|
|
|
|
if (compteur>*n)
|
|
|
|
|
{
|
|
|
|
@ -514,9 +514,9 @@ int supressionclient (int *n)
|
|
|
|
|
tabCAG[compteur]=cagnotte;
|
|
|
|
|
tabsuspension[compteur]=suspension;
|
|
|
|
|
compteur=compteur+1;
|
|
|
|
|
fscanf(fichierClientmegacool,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
fscanf(fichierclients,"%d%f%d",&nc,&cagnotte,&suspension);
|
|
|
|
|
}
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
fclose(fichierclients);
|
|
|
|
|
|
|
|
|
|
for (compteur=0;compteur<*n;compteur++)
|
|
|
|
|
if (tabNC[compteur]==recherche2)
|
|
|
|
@ -540,8 +540,8 @@ int supressionclient (int *n)
|
|
|
|
|
return -6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fichierClientmegacool=fopen("fichierclient.don","w");
|
|
|
|
|
if (fichierClientmegacool==NULL)
|
|
|
|
|
fichierclients=fopen("fichierclient.don","w");
|
|
|
|
|
if (fichierclients==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Probléme d'ouverture");
|
|
|
|
|
return -2;
|
|
|
|
@ -549,9 +549,9 @@ int supressionclient (int *n)
|
|
|
|
|
|
|
|
|
|
for (compteur=0;compteur<*n;compteur++)
|
|
|
|
|
|
|
|
|
|
fprintf(fichierClientmegacool, "%d\t%.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabsuspension[compteur]);
|
|
|
|
|
fprintf(fichierclients, "%d\t%.2f\t%d\n",tabNC[compteur],tabCAG[compteur],tabsuspension[compteur]);
|
|
|
|
|
|
|
|
|
|
fclose(fichierClientmegacool);
|
|
|
|
|
fclose(fichierclients);
|
|
|
|
|
|
|
|
|
|
printf("client supprimé.\n");
|
|
|
|
|
|
|
|
|
|