Modification des noms des fonctions et des variables

master
Kyllian CHABANON 2 years ago
parent 084d2b92d3
commit f8cc373d57

@ -1,15 +1,15 @@
#include "Fonctions.h" #include "Fonctions.h"
void Affichage1Adherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem) void Affichage1Adherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int nbElem)
{ {
int pas, NoCarte, CarteActive, trouve; int pas, noCarte, CarteActive, trouve;
printf("Entrez le numéro de la carte de l'adhérent recherché : "); printf("Entrez le numéro de la carte de l'adhérent recherché : ");
scanf("%d", &NoCarte); scanf("%d", &noCarte);
pas = rechercheAdherent(tNoCarte, nbelem, NoCarte, &trouve); pas = RechercheAdherent(tNoCarte, nbElem, noCarte, &trouve);
if (trouve == 1) if (trouve == 1)
{ {
printf("\nN° de carte\tAge\tPoints\tEtat\n"); printf("\nN° de carte\tAge\tPoints\tEtat\n");
printf("%d\t%d\t%d\t%d\n", tNoCarte[pas], tage[pas], tPointsCarte[pas], tCarteActive[pas]); printf("%d\t%d\t%d\t%d\n", tNoCarte[pas], tAge[pas], tPointsCarte[pas], tCarteActive[pas]);
} }
else else
{ {
@ -18,40 +18,40 @@ void Affichage1Adherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCar
} }
} }
void AffichageTousAdherents(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem) void AffichageTousAdherents(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int nbElem)
{ {
int i; int i;
printf("\nN° de carte\tAge\tPoints\tEtat\n"); printf("\nN° de carte\tAge\tPoints\tEtat\n");
for (i = 0; i < nbelem; i++) for (i = 0; i < nbElem; i++)
{ {
printf("%d\t\t%d\t%d\t%d\n", tNoCarte[i], tage[i], tPointsCarte[i], tCarteActive[i]); printf("%d\t\t%d\t%d\t%d\n", tNoCarte[i], tAge[i], tPointsCarte[i], tCarteActive[i]);
} }
} }
void AffichageNbEntreesTousJour(int tNbActivitesJour[], int tDate[], int nbelem) void AffichageNbEntreesTousJour(int tNbActivitesJour[], int tDate[], int nbElem)
{ {
int i; int i;
printf("\nDate\tNb activités\n"); printf("\nDate\tNb activités\n");
for (i = 0; i < nbelem; i++) for (i = 0; i < nbElem; i++)
{ {
printf("%d\t%d\n", tDate[i], tNbActivitesJour[i]); printf("%d\t%d\n", tDate[i], tNbActivitesJour[i]);
} }
} }
void AffichageNbEntreesTotal(int tNbActivitesJour[], int nbelem) void AffichageNbEntreesTotal(int tNbActivitesJour[], int nbElem)
{ {
int i, somme = 0; int i, somme = 0;
for (i = 0; i < nbelem; i++) for (i = 0; i < nbElem; i++)
{ {
somme = somme + tNbActivitesJour[i]; somme = somme + tNbActivitesJour[i];
} }
printf("Le nombre total d'entrées est de %d depuis le début.\n", somme); printf("Le nombre total d'entrées est de %d depuis le début.\n", somme);
} }
void AffichageNbAdherents(int nbelem) void AffichageNbAdherents(int nbElem)
{ {
int i, somme = 0; int i, somme = 0;
for (i = 0; i < nbelem; i++) for (i = 0; i < nbElem; i++)
{ {
somme = somme + 1; somme = somme + 1;
} }

@ -2,34 +2,34 @@
#include <stdlib.h> #include <stdlib.h>
/* Fonctions d'ouverture des fichiers texte */ /* Fonctions d'ouverture des fichiers texte */
int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tmax, int *pasAct); int Ouverture(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tMax, int *pasAct);
int OuvertureMembres(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tmax); int OuvertureMembres(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int tMax);
int OuvertureActivitesJour(int tNbActivitesJour[], int tDate[], int tmax); int OuvertureActivitesJour(int tNbActivitesJour[], int tDate[], int tMax);
/* Fonctions des menus */ /* Fonctions des menus */
int choixMenu(void); int ChoixMenu(void);
int choixMenuAffichage(void); int ChoixMenuAffichage(void);
/* Fonctions d'affichage */ /* Fonctions d'affichage */
void Affichage1Adherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem); void Affichage1Adherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int nbElem);
void AffichageTousAdherents(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem); void AffichageTousAdherents(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int nbElem);
void AffichageNbEntreesTousJour(int tNbActivitesJour[], int tDate[], int nbelem); void AffichageNbEntreesTousJour(int tNbActivitesJour[], int tDate[], int nbElem);
void AffichageNbEntreesTotal(int tNbActivitesJour[], int nbelem); void AffichageNbEntreesTotal(int tNbActivitesJour[], int nbElem);
void AffichageNbAdherents(int nbelem); void AffichageNbAdherents(int nbElem);
/* Fonction globale */ /* Fonction globale */
void gestionMenus(void); void GestionMenus(void);
/* Fonction de sauvegarde */ /* Fonction de sauvegarde */
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);
/* Fonctions de gestion des adhérents */ /* Fonctions de gestion des adhérents */
int rechercheAdherent(int tNoCarte[], int nbelem, int NoCarte, int *trouve); int RechercheAdherent(int tNoCarte[], int nbElem, int NoCarte, int *trouve);
int AjoutAdherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tmax, int nbelem); int AjoutAdherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int tMax, int nbElem);
void ModificationAge(int tNoCarte[], int tage[], int nbelem); void ModificationAge(int tNoCarte[], int tAge[], int nbElem);
int SupprimmerAdherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem); int SupprimerAdherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int nbElem);
void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbelem); void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbElem);
/* Fonctions de gestion des points */ /* Fonctions de gestion des points */
void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbelem); void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbElem);
void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbelem); void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbElem);

@ -1,16 +1,16 @@
#include "Fonctions.h" #include "Fonctions.h"
int rechercheAdherent(int tNoCarte[], int nbelem, int NoCarte, int *trouve) int RechercheAdherent(int tNoCarte[], int nbElem, int noCarte, int *trouve)
{ {
int i; int i;
for (i = 0; i < nbelem; i++) for (i = 0; i < nbElem; i++)
{ {
if (tNoCarte[i] == NoCarte) if (tNoCarte[i] == noCarte)
{ {
*trouve = 1; *trouve = 1;
return i; return i;
} }
if (tNoCarte[i] > NoCarte) if (tNoCarte[i] > noCarte)
{ {
*trouve = 0; *trouve = 0;
return i + 1; return i + 1;
@ -18,59 +18,59 @@ int rechercheAdherent(int tNoCarte[], int nbelem, int NoCarte, int *trouve)
} }
} }
int AjoutAdherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tmax, int nbelem) int AjoutAdherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int tMax, int nbElem)
{ {
int NoCarte, age, pointsCarte, CarteActive, pas, trouve, j; int noCarte, age, pointsCarte, pas, trouve, j;
char reponse; char reponse;
printf("Vous voulez créer un nouvel adhérent.\n"); printf("Vous voulez créer un nouvel adhérent.\n");
printf("Donnez l'âge de l'adhérent : "); printf("Donnez l'âge de l'adhérent : ");
scanf("%d", &age); scanf("%d", &age);
pas = rechercheAdherent(tNoCarte, nbelem, NoCarte, &trouve); pas = RechercheAdherent(tNoCarte, nbElem, noCarte, &trouve);
printf("%d\n", pas); printf("%d\n", pas);
for (j = nbelem; j > pas; j--) for (j = nbElem; j > pas; j--)
{ {
if (j == tmax) if (j == tMax)
{ {
printf("Tableau plein, impossible d'ajouter un adhérent.\n"); printf("Tableau plein, impossible d'ajouter un adhérent.\n");
return -1; return -1;
} }
tNoCarte[j] = tNoCarte[j - 1]; tNoCarte[j] = tNoCarte[j - 1];
tage[j] = tage[j - 1]; tAge[j] = tAge[j - 1];
tPointsCarte[j] = tPointsCarte[j - 1]; tPointsCarte[j] = tPointsCarte[j - 1];
tCarteActive[j] = tCarteActive[j - 1]; tCarteActive[j] = tCarteActive[j - 1];
} }
tNoCarte[pas] = pas + 1; tNoCarte[pas] = pas + 1;
printf("%d\n", tNoCarte[pas]); printf("%d\n", tNoCarte[pas]);
tage[pas] = age; tAge[pas] = age;
tPointsCarte[pas] = 0; tPointsCarte[pas] = 0;
tCarteActive[pas] = 0; tCarteActive[pas] = 0;
nbelem++; nbElem++;
printf("Vous avez créé l'adhérent numéro %d. Il a %d ans.\nSa carte n'est pas active car il n'y a pas de points dessus.\nVoulez-vous en ajouter ? (o/n)\n", tNoCarte[pas], tage[pas]); printf("Vous avez créé l'adhérent numéro %d. Il a %d ans.\nSa carte n'est pas active car il n'y a pas de points dessus.\nVoulez-vous en ajouter ? (o/n)\n", tNoCarte[pas], tAge[pas]);
scanf("%*c%c", &reponse); scanf("%*c%c", &reponse);
if (reponse == 'O' || reponse == 'o') if (reponse == 'O' || reponse == 'o')
{ {
AjoutPoints(tNoCarte, tPointsCarte, tCarteActive, nbelem); AjoutPoints(tNoCarte, tPointsCarte, tCarteActive, nbElem);
} }
else else
{ {
printf("La carte n'est pas active.\n"); printf("La carte n'est pas active.\n");
return nbelem; return nbElem;
} }
return nbelem; return nbElem;
} }
void ModificationAge(int tNoCarte[], int tage[], int nbelem) void ModificationAge(int tNoCarte[], int tAge[], int nbElem)
{ {
int pas, NoCarte, age, trouve; int pas, noCarte, age, trouve;
printf("Entrez le numéro de la carte de l'adhérent recherché : "); printf("Entrez le numéro de la carte de l'adhérent recherché : ");
scanf("%d", &NoCarte); scanf("%d", &noCarte);
pas = rechercheAdherent(tNoCarte, nbelem, NoCarte, &trouve); pas = RechercheAdherent(tNoCarte, nbElem, noCarte, &trouve);
if (trouve == 1) if (trouve == 1)
{ {
printf("Entrez le nouvel âge de l'adhérent : "); printf("Entrez le nouvel âge de l'adhérent : ");
scanf("%d", &age); scanf("%d", &age);
tage[pas] = age; tAge[pas] = age;
printf("Vous avez modifié l'âge de l'adhérent numéro %d. Son nouvel âge est %d.\n", NoCarte, age); printf("Vous avez modifié l'âge de l'adhérent numéro %d. Son nouvel âge est %d.\n", noCarte, age);
} }
else else
{ {
@ -79,24 +79,24 @@ void ModificationAge(int tNoCarte[], int tage[], int nbelem)
} }
} }
int SupprimmerAdherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem) int SupprimerAdherent(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int nbElem)
{ {
int pas, i, NoCarte, trouve; int pas, i, noCarte, trouve;
printf("Entrez le numéro de la carte de l'adhérent recherché : "); printf("Entrez le numéro de la carte de l'adhérent recherché : ");
scanf("%d", &NoCarte); scanf("%d", &noCarte);
pas = rechercheAdherent(tNoCarte, nbelem, NoCarte, &trouve); pas = RechercheAdherent(tNoCarte, nbElem, noCarte, &trouve);
if (trouve == 1) if (trouve == 1)
{ {
for (i = pas; i < nbelem; i++) for (i = pas; i < nbElem; i++)
{ {
tNoCarte[i] = tNoCarte[i + 1]; tNoCarte[i] = tNoCarte[i + 1];
tage[i] = tage[i + 1]; tAge[i] = tAge[i + 1];
tPointsCarte[i] = tPointsCarte[i + 1]; tPointsCarte[i] = tPointsCarte[i + 1];
tCarteActive[i] = tCarteActive[i + 1]; tCarteActive[i] = tCarteActive[i + 1];
} }
nbelem = nbelem - 1; nbElem = nbElem - 1;
printf("Vous avez bien supprimé l'adhérent numéro %d.\n", NoCarte); printf("Vous avez bien supprimé l'adhérent numéro %d.\n", noCarte);
return nbelem; return nbElem;
} }
else else
{ {
@ -105,12 +105,12 @@ int SupprimmerAdherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCart
} }
} }
void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbelem) void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbElem)
{ {
int NoCarte, trouve, pas, choix, choixRaison; int noCarte, trouve, pas, choix, choixRaison;
printf("Entrez le numéro de la carte de l'adhérent recherché : "); printf("Entrez le numéro de la carte de l'adhérent recherché : ");
scanf("%d", &NoCarte); scanf("%d", &noCarte);
pas = rechercheAdherent(tNoCarte, nbelem, NoCarte, &trouve); pas = RechercheAdherent(tNoCarte, nbElem, noCarte, &trouve);
if (trouve == 1) if (trouve == 1)
{ {
printf("\nQue voulez-vous faire ?\n1.\tActiver la carte\n2.\tDésactiver la carte\n"); printf("\nQue voulez-vous faire ?\n1.\tActiver la carte\n2.\tDésactiver la carte\n");
@ -128,7 +128,7 @@ void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbelem)
return; return;
} }
tCarteActive[pas] = 1; tCarteActive[pas] = 1;
printf("La carte numéro %d est désormais activée.\n", NoCarte); printf("La carte numéro %d est désormais activée.\n", noCarte);
} }
else if (choix == 2) else if (choix == 2)
{ {
@ -142,7 +142,7 @@ void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbelem)
return; return;
} }
tCarteActive[pas] = 0; tCarteActive[pas] = 0;
printf("La carte numéro %d est désormais désactivée.\n", NoCarte); printf("La carte numéro %d est désormais désactivée.\n", noCarte);
} }
} }
else else

@ -1,11 +1,11 @@
#include "Fonctions.h" #include "Fonctions.h"
void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbelem) void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbElem)
{ {
int pointsCarte, NoCarte, trouve, pas; int pointsCarte, noCarte, trouve, pas;
printf("Entrez le numéro de la carte de l'adhérent recherché : "); printf("Entrez le numéro de la carte de l'adhérent recherché : ");
scanf("%d", &NoCarte); scanf("%d", &noCarte);
pas = rechercheAdherent(tNoCarte, nbelem, NoCarte, &trouve); pas = RechercheAdherent(tNoCarte, nbElem, noCarte, &trouve);
if (trouve == 1) if (trouve == 1)
{ {
printf("Entrez le nombre de points à ajouter : "); printf("Entrez le nombre de points à ajouter : ");
@ -48,13 +48,13 @@ void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbe
} }
} }
void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbelem) void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbElem)
{ {
int NoCarte, trouve, pas, pointsCarte; int noCarte, trouve, pas, pointsCarte;
char reponse; char reponse;
printf("Entrez le numéro de la carte de l'adhérent recherché : "); printf("Entrez le numéro de la carte de l'adhérent recherché : ");
scanf("%d", &NoCarte); scanf("%d", &noCarte);
pas = rechercheAdherent(tNoCarte, nbelem, NoCarte, &trouve); pas = RechercheAdherent(tNoCarte, nbElem, noCarte, &trouve);
if (trouve == 1) if (trouve == 1)
{ {
if (tCarteActive[pas] == 1) if (tCarteActive[pas] == 1)

@ -21,76 +21,76 @@ Votre application doit pouvoir interdire à un adhérent de fréquenter le centr
*/ */
void gestionMenus(void) void GestionMenus(void)
{ {
int tNoCarte[20] = {0}, tage[20] = {0}, tPointsCarte[20] = {0}, tCarteActive[20] = {0}; int tNoCarte[20] = {0}, tAge[20] = {0}, tPointsCarte[20] = {0}, tCarteActive[20] = {0};
int tDate[20] = {0}, tNbActivitesJour[20] = {0}; int tDate[20] = {0}, tNbActivitesJour[20] = {0};
int tmax = 20, nbelem, choix, pasAct; int tMax = 20, nbElem, choix, pasAct;
char choixA; char choixA;
nbelem = Ouverture(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, tmax, &pasAct); nbElem = Ouverture(tNoCarte, tAge, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, tMax, &pasAct);
if (nbelem < 0) if (nbElem < 0)
{ {
printf("Erreur d'ouverture du fichier ou tableau plein !!!\n"); printf("Erreur d'ouverture du fichier ou tableau plein !!!\n");
return; return;
} }
choix = choixMenu(); choix = ChoixMenu();
while (choix != 8) while (choix != 8)
{ {
if (choix == 1) if (choix == 1)
{ {
choixA = choixMenuAffichage(); choixA = ChoixMenuAffichage();
while (choixA != 'F' && choixA != 'f') while (choixA != 'F' && choixA != 'f')
{ {
if (choixA == 'A' || choixA == 'a') if (choixA == 'A' || choixA == 'a')
{ {
Affichage1Adherent(tNoCarte, tage, tPointsCarte, tCarteActive, nbelem); Affichage1Adherent(tNoCarte, tAge, tPointsCarte, tCarteActive, nbElem);
} }
if (choixA == 'B' || choixA == 'b') if (choixA == 'B' || choixA == 'b')
{ {
AffichageTousAdherents(tNoCarte, tage, tPointsCarte, tCarteActive, nbelem); AffichageTousAdherents(tNoCarte, tAge, tPointsCarte, tCarteActive, nbElem);
} }
if (choixA == 'C' || choixA == 'c') if (choixA == 'C' || choixA == 'c')
{ {
AffichageNbEntreesTousJour(tNbActivitesJour, tDate, nbelem); AffichageNbEntreesTousJour(tNbActivitesJour, tDate, nbElem);
} }
if (choixA == 'D' || choixA == 'd') if (choixA == 'D' || choixA == 'd')
{ {
AffichageNbEntreesTotal(tNbActivitesJour, nbelem); AffichageNbEntreesTotal(tNbActivitesJour, nbElem);
} }
if (choixA == 'E' || choixA == 'e') if (choixA == 'E' || choixA == 'e')
{ {
AffichageNbAdherents(nbelem); AffichageNbAdherents(nbElem);
} }
choixA = choixMenuAffichage(); choixA = ChoixMenuAffichage();
} }
} }
if (choix == 2) if (choix == 2)
{ {
nbelem = AjoutAdherent(tNoCarte, tage, tPointsCarte, tCarteActive, tmax, nbelem); nbElem = AjoutAdherent(tNoCarte, tAge, tPointsCarte, tCarteActive, tMax, nbElem);
} }
if (choix == 3) if (choix == 3)
{ {
ModificationAge(tNoCarte, tage, nbelem); ModificationAge(tNoCarte, tAge, nbElem);
} }
if (choix == 4) if (choix == 4)
{ {
nbelem = SupprimmerAdherent(tNoCarte, tage, tPointsCarte, tCarteActive, nbelem); nbElem = SupprimerAdherent(tNoCarte, tAge, tPointsCarte, tCarteActive, nbElem);
} }
if (choix == 5) if (choix == 5)
{ {
AjoutPoints(tNoCarte, tPointsCarte, tCarteActive, nbelem); AjoutPoints(tNoCarte, tPointsCarte, tCarteActive, nbElem);
} }
if (choix == 6) if (choix == 6)
{ {
ModificationActivationCarte(tNoCarte, tCarteActive, nbelem); ModificationActivationCarte(tNoCarte, tCarteActive, nbElem);
} }
if (choix == 7) if (choix == 7)
{ {
DebitActivitee(tNoCarte, tCarteActive, tNbActivitesJour, nbelem); DebitActivitee(tNoCarte, tCarteActive, tNbActivitesJour, nbElem);
} }
choix = choixMenu(); choix = ChoixMenu();
} }
Sauvegarde(tNoCarte, tage, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, nbelem); Sauvegarde(tNoCarte, tAge, tPointsCarte, tCarteActive, tNbActivitesJour, tDate, nbElem);
exit(1); exit(1);
} }

@ -1,6 +1,6 @@
#include "Fonctions.h" #include "Fonctions.h"
int choixMenu(void) int ChoixMenu(void)
{ {
int choix; int choix;
printf("\n\tMenu principal\n"); printf("\n\tMenu principal\n");
@ -17,7 +17,7 @@ int choixMenu(void)
return choix; return choix;
} }
int choixMenuAffichage(void) int ChoixMenuAffichage(void)
{ {
char choix; char choix;
printf("\n\tMenu d'affichage\n"); printf("\n\tMenu d'affichage\n");

@ -1,17 +1,17 @@
#include "Fonctions.h" #include "Fonctions.h"
int Ouverture(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tmax, int *pasAct) int Ouverture(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int tMax, int *pasAct)
{ {
int pasMembres; int pasMembres;
pasMembres = OuvertureMembres(tNoCarte, tage, tPointsCarte, tCarteActive, tmax); pasMembres = OuvertureMembres(tNoCarte, tAge, tPointsCarte, tCarteActive, tMax);
*pasAct = OuvertureActivitesJour(tNbActivitesJour, tDate, tmax); *pasAct = OuvertureActivitesJour(tNbActivitesJour, tDate, tMax);
return pasMembres; return pasMembres;
} }
int OuvertureMembres(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tmax) int OuvertureMembres(int tNoCarte[], int tAge[], int tPointsCarte[], int tCarteActive[], int tMax)
{ {
int i = 0; int i = 0;
int NoCarte, age, pointsCarte, CarteActive; int noCarte, age, pointsCarte, carteActive;
FILE *flot; FILE *flot;
flot = fopen("membres.don", "r"); flot = fopen("membres.don", "r");
if (flot == NULL) if (flot == NULL)
@ -19,30 +19,30 @@ int OuvertureMembres(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteA
printf("Problème d'ouverture du fichier membres.don en lecture.\n"); printf("Problème d'ouverture du fichier membres.don en lecture.\n");
return -1; return -1;
} }
fscanf(flot, "%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive); fscanf(flot, "%d%d%d%d", &noCarte, &age, &pointsCarte, &carteActive);
while (!feof(flot)) while (!feof(flot))
{ {
if (i == tmax) if (i == tMax)
{ {
printf("Tableau plein.\n"); printf("Tableau plein.\n");
fclose(flot); fclose(flot);
return -1; return -1;
} }
tNoCarte[i] = NoCarte; tNoCarte[i] = noCarte;
tage[i] = age; tAge[i] = age;
tPointsCarte[i] = pointsCarte; tPointsCarte[i] = pointsCarte;
tCarteActive[i] = CarteActive; tCarteActive[i] = carteActive;
fscanf(flot, "%d%d%d%d", &NoCarte, &age, &pointsCarte, &CarteActive); fscanf(flot, "%d%d%d%d", &noCarte, &age, &pointsCarte, &carteActive);
i++; i++;
} }
fclose(flot); fclose(flot);
return i; return i;
} }
int OuvertureActivitesJour(int tNbActivitesJour[], int tDate[], int tmax) int OuvertureActivitesJour(int tNbActivitesJour[], int tDate[], int tMax)
{ {
int i = 0; int i = 0;
int Date, nbActivitesJour; int date, nbActivitesJour;
FILE *jour; FILE *jour;
jour = fopen("ActivitesJour.don", "r"); jour = fopen("ActivitesJour.don", "r");
if (jour == NULL) if (jour == NULL)
@ -50,18 +50,18 @@ int OuvertureActivitesJour(int tNbActivitesJour[], int tDate[], int tmax)
printf("Problème d'ouverture du fichier ActivitesJour.don en lecture.\n"); printf("Problème d'ouverture du fichier ActivitesJour.don en lecture.\n");
return -1; return -1;
} }
fscanf(jour, "%d%d", &Date, &nbActivitesJour); fscanf(jour, "%d%d", &date, &nbActivitesJour);
while (!feof(jour)) while (!feof(jour))
{ {
if (i == tmax) if (i == tMax)
{ {
printf("Tableau plein.\n"); printf("Tableau plein.\n");
fclose(jour); fclose(jour);
return -1; return -1;
} }
tDate[i] = Date; tDate[i] = date;
tNbActivitesJour[i] = nbActivitesJour; tNbActivitesJour[i] = nbActivitesJour;
fscanf(jour, "%d%d", &Date, &nbActivitesJour); fscanf(jour, "%d%d", &date, &nbActivitesJour);
i++; i++;
} }
fclose(jour); fclose(jour);

@ -1,6 +1,6 @@
#include "Fonctions.h" #include "Fonctions.h"
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;
FILE *flot, *jour; FILE *flot, *jour;
@ -16,11 +16,11 @@ int Sauvegarde(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[
printf("Problème d'ouverture du fichier ActivitesJour.don en écriture.\n"); printf("Problème d'ouverture du fichier ActivitesJour.don en écriture.\n");
return -1; return -1;
} }
for (i = 0; i < (nbelem - 1); i++) 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]); 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++) for (j = 0; j < (nbElem - 1); j++)
{ {
fprintf(jour, "%d\t\t%d\n", tDate[j], tNbActivitesJour[j]); fprintf(jour, "%d\t\t%d\n", tDate[j], tNbActivitesJour[j]);
} }

@ -23,6 +23,6 @@ int main(void)
{ {
//testOuverture(); //testOuverture();
//testSauvegarde(); //testSauvegarde();
gestionMenus(); GestionMenus();
return 0; return 0;
} }
Loading…
Cancel
Save