diff --git a/SAE.c b/SAE.c new file mode 100644 index 0000000..ea3d41e --- /dev/null +++ b/SAE.c @@ -0,0 +1,87 @@ +#include "SAE.h" + +int Ouverture(int tNoCarte[],int tnom[], int tprenom[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitéesJour[]) +{ + int NoCarte, nom, prenom, age, pointsCarte, CarteActive, nbActivitéesJour; + int tmax = 500, i = 0; + int tNoCarte[500], tage[500], tPointsCarte[500], tNbActivitéesJour[500]; + char tnom[500], tprenom[500]; + char tCarteActive[500]; + FILE *flot; + flot = fopen("membres.don", "r"); + if(flot == NULL) + { + printf("Pb d'ouverture du fichier membres.don\n"); + return -1; + } + fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &nom, &prenom, &age, &pointsCarte, &CarteActive, &nbActivitéesJour); + while(!feof(flot)) + { + if(i == tmax) + { + printf("Tableau plein\n"); + fclose(flot); + return -1; + } + tNoCarte[i] = NoCarte; + tnom[i] = nom; + tprenom[i] = prenom; + tage[i] = age; + tPointsCarte[i] = pointsCarte; + tCarteActive[i] = CarteActive; + tNbActivitéesJour[i] = nbActivitéesJour; + fscanf(flot, "%d%d%d%d%d%d%d", &NoCarte, &nom, &prenom, &age, &pointsCarte, &CarteActive, &nbActivitéesJour); + i++; + } + fclose(flot); + return i; +} + +void pointsBonus() +{ + +} + +void Sauvegarde(int tNoCarte[],int tnom[], int tprenom[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitéesJour[], int nbelem) +{ + int i; + FILE *flot; + flot = fopen("membres.don", "w"); + if(flot == NULL) + { + printf("Pb d'ouverture du fichier membres.don\n"); + return -1; + } + for(i = 0; i < (nbelem-1); i++) + { + fprintf(flot, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", tNoCarte[i], tnom[i], tprenom[i], tage[i], tPointsCarte[i], tCarteActive[i], tNbActivitéesJour[i]); + } + fclose(flot); +} + +int rechercheEtCreation(int tNoCarte[], int nbClients) +{ + int NoCarte, i; + for( i=0; i < nbClients; i++) + { + if(i != tNoCarte[i]) + { + return i; + } + } + return i; +} + +int CreationAdherents(int tAdherents[], nbClients) +{ + int NoCarte, nom, prenom, age, pointsCarte, CarteActive, nbActivitéesJour; + printf("Donnez le nom, le prénom, l'âge du client :\n"); + scanf("%d%d%d", &nom, &prenom, &age); + pas = rechercheEtCreation(tAdherents, nbClients); +} + +int FrequenceCentre() +{ + +} +