|
|
@ -1,25 +1,26 @@
|
|
|
|
#include "SAE.h"
|
|
|
|
#include "SAE.h"
|
|
|
|
|
|
|
|
|
|
|
|
int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tmax)
|
|
|
|
int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tmax, int *pasAct)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i = 0, j = 0;
|
|
|
|
int pasMembres, pasAct;
|
|
|
|
|
|
|
|
pasMembres = OuvertureMembres(tNoCarte, tage, tPointsCarte, tCarteActive, tmax);
|
|
|
|
|
|
|
|
pasAct = OuvertureActivitesJour(tNbActivitesJour, tDate, tmax);
|
|
|
|
|
|
|
|
*pasAct = pasAct;
|
|
|
|
|
|
|
|
return pasMembres
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int OuvertureMembres(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tmax)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
int NoCarte, age, pointsCarte, CarteActive;
|
|
|
|
int NoCarte, age, pointsCarte, CarteActive;
|
|
|
|
int Date, nbActivitesJour;
|
|
|
|
FILE *flot;
|
|
|
|
FILE *flot, *jour;
|
|
|
|
|
|
|
|
flot = fopen("membres.don", "r");
|
|
|
|
flot = fopen("membres.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)
|
|
|
|
fscanf(flot, "%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive);
|
|
|
|
|
|
|
|
fscanf(jour, "%d%d", &Date, &nbActivitesJour);
|
|
|
|
|
|
|
|
while(!feof(flot))
|
|
|
|
while(!feof(flot))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(i == tmax)
|
|
|
|
if(i == tmax)
|
|
|
@ -35,24 +36,128 @@ 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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(flot);
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int OuvertureActivitesJour(int tNbActivitesJour[], int tDate[], int tmax)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
int Date, nbActivitesJour;
|
|
|
|
|
|
|
|
FILE *jour;
|
|
|
|
|
|
|
|
jour = fopen("ActivitesJour.don", "r");
|
|
|
|
|
|
|
|
if(jour == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fscanf(jour, "%d%d", &Date, &nbActivitesJour);
|
|
|
|
while(!feof(jour))
|
|
|
|
while(!feof(jour))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(j == tmax)
|
|
|
|
if(i == tmax)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Tableau plein\n");
|
|
|
|
printf("Tableau plein\n");
|
|
|
|
fclose(jour);
|
|
|
|
fclose(jour);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tDate[j] = Date;
|
|
|
|
tDate[i] = Date;
|
|
|
|
tNbActivitesJour[j] = nbActivitesJour;
|
|
|
|
tNbActivitesJour[i] = nbActivitesJour;
|
|
|
|
fscanf(jour, "%d%d", &Date, &nbActivitesJour);
|
|
|
|
fscanf(jour, "%d%d", &Date, &nbActivitesJour);
|
|
|
|
j++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(jour);
|
|
|
|
fclose(jour);
|
|
|
|
fclose(flot);
|
|
|
|
|
|
|
|
return i;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int choixMenu(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int choix;
|
|
|
|
|
|
|
|
printf("\t Gestion des matières\n");
|
|
|
|
|
|
|
|
printf("1.\taffichage\n");
|
|
|
|
|
|
|
|
printf("2.\tAjouter un client\n");
|
|
|
|
|
|
|
|
printf("3.\tModifier l'âge d'un client\n");
|
|
|
|
|
|
|
|
printf("4.\tsuppression d'un client\n");
|
|
|
|
|
|
|
|
printf("5.\tAjout de points sur une carte\n");
|
|
|
|
|
|
|
|
printf("6.\tModification de l'état de la carte\n");
|
|
|
|
|
|
|
|
printf("7.\tCréditer une activité à une carte\n");
|
|
|
|
|
|
|
|
printf("8.\tquitter\n");
|
|
|
|
|
|
|
|
printf("\noption choisie :\n");
|
|
|
|
|
|
|
|
scanf("%d", &choix);
|
|
|
|
|
|
|
|
return choix;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void gestionMatieres(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int tNoCarte[20] = {0}, tage[20] = {0}, tPointsCarte[20] = {0}, tCarteActive[20] = {0};
|
|
|
|
|
|
|
|
int tDate[20] = {0}, tNbActivitesJour[20] = {0};
|
|
|
|
|
|
|
|
int tmax = 20, nbelem, choix, pasAct;
|
|
|
|
|
|
|
|
nbelem = Ouverture(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, tmax, &pasAct);
|
|
|
|
|
|
|
|
if(nbMatieres < 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Erreur d'ouverture du fichier ou tableau plein !!!\n");
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
choix = choixMenu();
|
|
|
|
|
|
|
|
while(choix != 9)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(choix == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
affichage(tMatieres, tCoeff, nbMatieres);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(choix == 2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
modificationCoefficient(tMatieres, tCoeff, nbMatieres);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(choix == 3)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
nbMatieres = insertionNewMatiere(tMatieres, tCoeff, nbMatieres, max);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(choix == 4)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
nbMatieres = suppressionMatiere(tMatieres, tCoeff, nbMatieres);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(choix == 5)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MoyenneNotesMatiere(tMatieres, tNotes, tNbNotes, nbMatieres);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(choix == 6)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MoyenneEtudiant(tCoeff, tMatieres, tNotes, tNbNotes, nbMatieres);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
choix = choixMenu();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sauvegarde(tMatieres, tCoeff, nbMatieres);
|
|
|
|
|
|
|
|
fclose(flot);
|
|
|
|
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
FILE *flot, *jour;
|
|
|
|
|
|
|
|
flot = fopen("membres.don", "a");
|
|
|
|
|
|
|
|
jour = fopen("ActivitesJour.don", "a");
|
|
|
|
|
|
|
|
if(flot == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Pb d'ouverture du fichier membres.don\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(jour == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; i < (nbelem-1); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fprintf(flot, "\t%d\t%d\t\t%d\t\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j = 0; j < (nbelem-1); j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fprintf(jour, "%d\t\t%d\n", tDate[j], tNbActivitesJour[j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(jour);
|
|
|
|
|
|
|
|
fclose(flot);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ajouterPoints(int tNumCarte[], int tPoints[], int tailleLog)
|
|
|
|
void ajouterPoints(int tNumCarte[], int tPoints[], int tailleLog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -118,36 +223,10 @@ int recherche(int tab[], int tailleLog, int valeur, int *trouve)
|
|
|
|
return tailleLog;
|
|
|
|
return tailleLog;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
FILE *flot, *jour;
|
|
|
|
|
|
|
|
flot = fopen("membres.don", "a");
|
|
|
|
|
|
|
|
jour = fopen("ActivitesJour.don", "a");
|
|
|
|
|
|
|
|
if(flot == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Pb d'ouverture du fichier membres.don\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(jour == NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Pb d'ouverture du fichier ActivitesJour.don\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; i < (nbelem-1); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fprintf(flot, "\t%d\t%d\t\t%d\t\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j = 0; j < (nbelem-1); j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fprintf(jour, "%d\t\t%d\n", tDate[j], tNbActivitesJour[j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(jour);
|
|
|
|
|
|
|
|
fclose(flot);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ajoutPointsCarte(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbelem)
|
|
|
|
int ajoutPointsCarte(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbelem)
|
|
|
|
{
|
|
|
|
{
|
|
|
|