diff --git a/SAE.c b/SAE.c index 1ef3001..2f8ff2f 100644 --- a/SAE.c +++ b/SAE.c @@ -380,7 +380,7 @@ void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbe } } -void DebitActivitee(int tNoCarte[], int tPointsCarte[], int tNbActivitesJour[], int tDate[], int nbelem, int *pasAct) +void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbelem) { int NoCarte, trouve, pas, pointsCarte; char reponse; @@ -449,172 +449,4 @@ void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbelem) printf("Ce numéro d'adhérant n'existe pas, veuillez réessayer\n"); return -1; } -} - -void DebitActivitee(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tNbActivitesJour[], int tDate[], int nbelem) -{ - int NoCarte, trouve, pas, pointsCarte; - char reponse; - printf("Entrez le numéro de la carte de l'adhérent recherché : "); - scanf("%d",&NoCarte); - pas = rechercheAdherant(tNoCarte, nbelem, NoCarte, &trouve); - if(trouve == 1) - { - if(tCarteActive[pas] == 1) - { - printf("Voulez-vous desactiver cette carte ? (O/N)\n"); - scanf("%*c%c", &reponse); - if(reponse == 'O' || reponse == 'o') - { - tCarteActive[pas] = 0; - printf("La carte est desactivée.\n"); - } - else - { - printf("La carte est toujours active.\n"); - } - } - else - { - printf("La carte est desactivée. Voulez-vous la réactiver ? (O/N)\n"); - scanf("%*c%c", &reponse); - if(reponse == 'O' || reponse == 'o') - { - tCarteActive[pas] = 1; - printf("La carte est activée.\n"); - } - else - { - printf("La carte est toujours desactivée.\n"); - } - } - } - else - { - printf("Ce numéro d'adhérant n'existe pas, veuillez réessayer\n"); - return -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); -} - -int ajoutPointsCarte(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbelem) -{ - int i, NoCarte, pointsCarte, CarteActive; - printf("Entrez le numero de carte de l'adherent: "); - scanf("%d", &NoCarte); - for(i = 0; i < nbelem; i++) - { - if(NoCarte == tNoCarte[i]) - { - printf("Entrez le nombre de points a ajouter: "); - scanf("%d", &pointsCarte); - tPointsCarte[i] += pointsCarte; - printf("Le nombre de points de l'adherent est maintenant de %d\n", tPointsCarte[i]); - if(tPointsCarte[i] >= 1000) - { - tCarteActive[i] = 1; - printf("La carte de l'adherent est maintenant active\n"); - } - return 0; - } - } - printf("Le numero de carte n'existe pas\n"); - return -1; -} - -int rechercheEtCreation(int tNoCarte[], int nbelem) -{ - int NoCarte, i; - for( i=0; i < nbelem; i++) - { - if((i + 1) != tNoCarte[i]) - { - return i; - } - } - return i; -} - -int CreationAdherents(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem) -{ - int NoCarte, age, pointsCarte, CarteActive, pas; - char reponse; - printf("Donnez l'âge du client :\n"); - scanf("%d", &age); - pas = rechercheEtCreation(tNoCarte, nbelem); - for(j=nbelem; j> pas; j--) - { - tNoCarte[j] = tNoCarte[j-1]; - tage[j] = tage[j-1]; - tPointsCarte[j] = tPointsCarte[j-1]; - tCarteActive[j] = tCarteActive[j-1]; - } - tNoCarte[pas] = - tMatieres[i]= matieres; - tCoeff[i] = coeff; - nbMatieres = nbMatieres + 1; - return nbMatieres; - tNoCarte[pas] = tNoCarte[pas] + 1; - tage[pas] = age; - tPointsCarte[pas] = 0; - tCarteActive[pas] = 0; - printf("Le numero de carte de l'adherent qui a %d ans est %d.\nLa carte n'est pas active car il n'y a pas de points dessus.\nVoulez-vous en ajouter ? (O / N)", tage[pas], tNoCarte[pas]); - scanf("%*c%c", &reponse); - if(reponse == 'O' || reponse == 'o') - { - printf("Entrez le nombre de points a ajouter: "); - scanf("%d", &pointsCarte); - if(pointsCarte > 0) - tPointsCarte[pas] = tPointsCarte[pas] + pointsCarte; - printf("Le nombre de points de l'adherent est maintenant de %d\nVotre carte est désormais", tPointsCarte[pas]); - } - nbelem = nbelem + 1; -} - -void pointsBonus() -{ - -} - -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() -{ - -} -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/SAE.h b/SAE.h index 4a7ab8d..5badddf 100644 --- a/SAE.h +++ b/SAE.h @@ -29,9 +29,9 @@ void testSauvegarde(void); int rechercheAdherant (int tNoCarte[], int nbelem, int NoCarte, int *trouve); int AjoutAdherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int tmax, int nbelem); void ModificationAge(int tNoCarte[], int tage[], int nbelem); -void modificationEtat(int tNumCarte[], int tEtat[], int tailleLog); +int SupprimmerAdherent(int tNoCarte[], int tage[], int tPointsCarte[], int tCarteActive[], int nbelem); +void ModificationActivationCarte(int tNoCarte[], int tCarteActive[], int nbelem); -/* Fonstions de gestion des points */ -void ajouterPoints(int tNumCarte[], int tPoints[], int tailleLog); -int recherche(int tab[], int tailleLog, int valeur, int *trouve); -int modifierPoints(int tNumCarte[], int tPoints[], int tailleLog, int numCarte, int points); \ No newline at end of file +/* Fonctions de gestion des points */ +void AjoutPoints(int tNoCarte[], int tPointsCarte[], int tCarteActive[], int nbelem, int pas); +void DebitActivitee(int tNoCarte[], int tCarteActive[], int tNbActivitesJour[], int nbelem); \ No newline at end of file