|
|
@ -8,21 +8,21 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
|
|
|
|
FILE *flot, *jour;
|
|
|
|
FILE *flot, *jour;
|
|
|
|
flot = fopen("membres.don", "r");
|
|
|
|
flot = fopen("membres.don", "r");
|
|
|
|
jour = fopen("ActivitesJour.don", "r");
|
|
|
|
jour = fopen("ActivitesJour.don", "r");
|
|
|
|
if(flot == NULL)
|
|
|
|
if (flot == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Pb d'ouverture du fichier membres.don\n");
|
|
|
|
printf("Pb d'ouverture du fichier membres.don\n");
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(jour == NULL)
|
|
|
|
if (jour == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
|
|
|
|
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
|
|
|
|
fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
|
|
|
|
fscanf(jour, "%d%d", &Date, &nbActivitesJour);
|
|
|
|
fscanf(jour, "%d%d", &Date, &nbActivitesJour);
|
|
|
|
while(!feof(flot))
|
|
|
|
while (!feof(flot))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(i == tmax)
|
|
|
|
if (i == tmax)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Tableau plein\n");
|
|
|
|
printf("Tableau plein\n");
|
|
|
|
fclose(flot);
|
|
|
|
fclose(flot);
|
|
|
@ -35,9 +35,9 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
|
|
|
|
fscanf(flot, "%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
|
|
|
|
fscanf(flot, "%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while(!feof(jour))
|
|
|
|
while (!feof(jour))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(j == tmax)
|
|
|
|
if (j == tmax)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Tableau plein\n");
|
|
|
|
printf("Tableau plein\n");
|
|
|
|
fclose(jour);
|
|
|
|
fclose(jour);
|
|
|
@ -53,6 +53,25 @@ int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[]
|
|
|
|
return i;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int recherche(int tab[], int tailleLog, int valeur, int *trouve)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int i = 0; i < tailleLog; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (tab[i] == valeur)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
*trouve = 1;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (tab[i] > valeur)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
*trouve = 0;
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*trouve = 0;
|
|
|
|
|
|
|
|
return tailleLog;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ajouterPoints(int tNumCarte[], int tPoints[], int tailleLog)
|
|
|
|
void ajouterPoints(int tNumCarte[], int tPoints[], int tailleLog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -72,12 +91,15 @@ void ajouterPoints(int tNumCarte[], int tPoints[], int tailleLog)
|
|
|
|
scanf("%d", &nbPoints);
|
|
|
|
scanf("%d", &nbPoints);
|
|
|
|
printf("Vous voulez bien ajouter %d points à la carte n°%d ? (O/n)", nbPoints, numCarte);
|
|
|
|
printf("Vous voulez bien ajouter %d points à la carte n°%d ? (O/n)", nbPoints, numCarte);
|
|
|
|
scanf("%c%*c", &choix);
|
|
|
|
scanf("%c%*c", &choix);
|
|
|
|
if (choix == 'n' || choix == 'N') {
|
|
|
|
if (choix == 'n' || choix == 'N')
|
|
|
|
|
|
|
|
{
|
|
|
|
printf("Annulation");
|
|
|
|
printf("Annulation");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
modifierPoints(tNumCarte, tPoints, tailleLog, numCarte, nbPoints);
|
|
|
|
modifierPoints(tNumCarte, tPoints, tailleLog, numCarte, nbPoints);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -99,28 +121,43 @@ int modifierPoints(int tNumCarte[], int tPoints[], int tailleLog, int numCarte,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int recherche(int tab[], int tailleLog, int valeur, int *trouve)
|
|
|
|
void modifierAge(int tNumCarte[], int tAge[], int tailleLog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i = 0; i < tailleLog; i++)
|
|
|
|
int numCarte, age, index, trouve;
|
|
|
|
|
|
|
|
char choix;
|
|
|
|
|
|
|
|
printf("Entrez le numéro d'adhérent : ");
|
|
|
|
|
|
|
|
scanf("%d", &numCarte);
|
|
|
|
|
|
|
|
index = recherche(tNumCarte, tailleLog, numCarte, &trouve);
|
|
|
|
|
|
|
|
while (trouve == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (tab[i] == valeur)
|
|
|
|
printf("Numéro de carte non trouvé. Veuillez réessayer.\nEntrez le numéro d'adhérent : ");
|
|
|
|
|
|
|
|
scanf("%d", &numCarte);
|
|
|
|
|
|
|
|
index = recherche(tNumCarte, tailleLog, numCarte, &trouve);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("Entrez le nouvel âge :");
|
|
|
|
|
|
|
|
scanf("%d", &age);
|
|
|
|
|
|
|
|
while (age <= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
*trouve = 1;
|
|
|
|
printf("Âge non valide. Veuillez réessayer.\nEntrez le nouvel âge : ");
|
|
|
|
return i;
|
|
|
|
scanf("%d", &age);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (tab[i] > valeur)
|
|
|
|
|
|
|
|
|
|
|
|
printf("Le nouvel âge du client n°%d est bien %d ? (O/n)", numCarte, age);
|
|
|
|
|
|
|
|
scanf("%c%*c", &choix);
|
|
|
|
|
|
|
|
if (choix == 'n' || choix == 'N')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
*trouve = 0;
|
|
|
|
printf("Annulation");
|
|
|
|
return i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tAge[index] = age;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*trouve = 0;
|
|
|
|
|
|
|
|
return tailleLog;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem)
|
|
|
|
int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
int i, j;
|
|
|
|