Menu GestionCompteAdherent fini (manque le travail de Jean)

main
DahmaneYanis 2 years ago
parent b75c881151
commit d074b7609b

@ -0,0 +1,5 @@
{
"files.associations": {
"stdlib.h": "c"
}
}

@ -9,3 +9,12 @@
#define clean system("cls");
#define color system("color 70");
#endif
#ifndef wait
#define wait printf("\nAppuyez sur entree pour continuer...");\
scanf("%*c%c", &trash);
#endif
#ifndef _rep_
#define _rep_ scanf(" %c", &rep);
#endif

@ -3,8 +3,8 @@
void GestionAdherent(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[], int *nbAdherents, int taillePhysique);
int AffichageGestionAdherent(void);
int AffichageGestionCompteAdherent(void);
void GestionCompteAdherent();
int CibleInfosAdherent(void);
int AffichageGestionCompteAdherent(int cible);
void GestionCompteAdherent(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[], int nbAdherents);
int CibleAdherent(int tabNoCarte[], int nbAdherents);
void AfficheBandeauGCA(void);

@ -61,14 +61,14 @@ void SupprimerAdherent(int *nbAdherents, int tabNoCarte[], int tabEtatCarte[], i
if (trouve == 0)
{
printf("\nNumero de carte %d inexistant. Souhaitez vous un affichage detaille des adherents (O/N) : ", cible);
scanf(" %c", &rep);
_rep_
// Verification de la validité de la réponse
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez vous un affichage detaille des adherents (O/N) : ");
scanf(" %c", &rep);
_rep_
}
if (rep == 'O')
@ -85,14 +85,14 @@ void SupprimerAdherent(int *nbAdherents, int tabNoCarte[], int tabEtatCarte[], i
AfficheInfosAdherent(cible, tabNoCarte, tabEtatCarte, tabPointCarte, *nbAdherents);
printf("\nConfirmez vous la suppression de l'adherent (O/N) : ");
scanf(" %c", &rep);
_rep_
// Verification de la validité de la réponse
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Confirmez vous la suppression de l'adherent %d (O/N) : ", tabNoCarte[indice]);
scanf(" %c", &rep);
_rep_
}
// Suppression de l'adherent
if (rep == 'O')
@ -120,14 +120,14 @@ void SupprimerAdherent(int *nbAdherents, int tabNoCarte[], int tabEtatCarte[], i
// Test pour savoir si on supprime encore un adhérent ou si on retourne au menu principal
printf("\nSouhaitez vous entrer un autre numero d'adherent (O/N) : ");
scanf(" %c", &rep);
_rep_
clean
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez vous entrer un autre numero d'adherent (O/N) : ");
scanf(" %c", &rep);
_rep_
}
if(rep == 'N')
@ -191,8 +191,7 @@ void AfficheAdherents(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[],
if (noPage+commande > nbPages || noPage+commande < 1)
{
help(1);
printf("\nAppuyer sur entree pour continuer...");
scanf("%*c%c", &trash);
wait
}
else
{
@ -313,13 +312,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
if (!trouve && indice == -1)
{
printf("Carte adherente introuvable. Souhaitez-vous rechercher un autre adherent (O/N) : ", noCarte);
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez vous entrer un autre numero d'adherent (O/N) : ");
scanf(" %c", &rep);
_rep_
}
// Abandon de la recharge
@ -347,13 +346,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
AfficheInfosAdherent(noCarte, tabNoCarte, tabEtatCarte, tabPointCarte, nbAdherents);
printf("\nVoulez-vous toujours recharger la carte numero %d (O/N) : ", noCarte);
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Voulez-vous toujours recharger la carte numero %d (O/N) : ", noCarte);
scanf(" %c", &rep);
_rep_
}
// Annulation de la recharge
@ -361,13 +360,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
{
clean
printf("Transaction annulee.\nSouhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
}
// Fin de programme
@ -403,13 +402,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
printf("\nTransaction de %d credits faite.\n", credit);
printf("Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
}
// Nouveau rechargement de carte
@ -433,13 +432,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
clean
printf("Etat de la carte actuel : %d", tabEtatCarte[indice]);
printf("\nVoulez-vous la reactiver (O/N) : ");
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte.\nEtat de la carte actuel : %d. Voulez-vous reactiver la carte numero %d (O/N) : ", tabEtatCarte[indice], noCarte);
scanf(" %c", &rep);
_rep_
}
// Réactivation de la carte et ajout des crédits
@ -452,13 +451,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
printf("\nTransaction de %d credits faite.\n", credit);
printf("Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
}
// Nouveau rechargement de carte
@ -481,13 +480,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
{
clean
printf("Souhaitez-vous effectuer quand meme la transaction de %d credit (O/N) : ", credit);
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez-vous effectuer quand meme la transaction de %d credit (O/N) : ", credit);
scanf(" %c", &rep);
_rep_
}
// Mettre des crédits sans réactiver la carte
@ -498,13 +497,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
printf("\nTransaction de %d credits faite.\n", credit);
printf("Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
}
// Nouveau rechargement de carte
@ -527,13 +526,13 @@ void RechargeCarte(int noCarte, int tabNoCarte[], int tabEtatCarte[], int tabPoi
{
clean
printf("Transaction annulee.\nSouhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez-vous faire une nouvelle transaction de credit (O/N) : ");
scanf(" %c", &rep);
_rep_
}
// Fin de programme
@ -614,14 +613,14 @@ void CreerAdherent(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[], in
clean
printf("Adherent cree. Souhaitez vous un affichage detaille des adherents (O/N) : ");
scanf(" %c", &rep);
_rep_
// Verification de la validité de la réponse
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez vous un affichage detaille des adherents (O/N) : ");
scanf(" %c", &rep);
_rep_
}
if (rep == 'O')
@ -631,14 +630,14 @@ void CreerAdherent(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[], in
clean
printf("Souhaitez vous creer un autre adherent (O/N) : ");
scanf(" %c", &rep);
_rep_
// Verification de la validité de la réponse
while (rep != 'N' && rep != 'O')
{
clean
printf("Reponse incorrecte. Souhaitez vous creer un autre adherent (O/N) : ");
scanf(" %c", &rep);
_rep_
}
if (rep == 'N')

@ -22,5 +22,7 @@ int main(void){
//int indice = TrouverAdherent(tabCarte, tailleLog, 5, &trouve);
//printf("Indice: %d\nTrouve = %d", indice, trouve);
//CreerAdherent(tabCarte, tabEtat, tabPoint, &tailleLog, taillePhysique);
GestionAdherent(tabCarte, tabEtat, tabPoint, &tailleLog, taillePhysique);
//GestionAdherent(tabCarte, tabEtat, tabPoint, &tailleLog, taillePhysique);
GestionCompteAdherent(tabCarte, tabEtat, tabPoint, tailleLog);
}

@ -54,35 +54,29 @@ void GestionAdherent(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[],
default :
clean
printf("\nChoix invalide.\n");
printf("Appuyez sur entree pour continuer...");
scanf("%c", &trash);
wait
}
}
}
#include "../header/menus.h"
#include "../header/adherent.h"
/**
* @brief Permet l'affichage de GestionCompteAdherent
*
* @return int Choix de l'utilisateur
*/
int AffichageGestionCompteAdherent(void)
int AffichageGestionCompteAdherent(int cible)
{
int choix;
clean
printf("===============================================================\n");
printf("\t\tMENU GESTION D'UN COMPTE ADHERENT\n");
printf("===============================================================\n");
AfficheBandeauGCA();
printf("[ADHERENT %d]\n", cible);
printf("\nChoix disponible :\n");
printf("\t0. Retour au menu principal\n");
printf("\t1. Afficher les infos d'un adherent\n");
printf("\t2. Recharger une carte\n");
printf("\t3. Desactiver/activer une carte\n");
printf("\t4. Changer d'adherent\n");
printf("\nChoix : ");
scanf("%d", &choix);
@ -95,44 +89,74 @@ int AffichageGestionCompteAdherent(void)
* @param tabNoCarte [TABLEAU] Liste des adherents
* @param tabEtatCarte [TABLEAU] Etats des cartes
* @param tabPointCarte [TABLEAU] Crédit des cartes
* @param nbAdherents [POINTEUR - Taille Logique] Nombre d'adhérents
* @param taillePhysique [Taille Physique]
* @param nbAdherents [Taille Logique] Nombre d'adhérents
*/
void GestionCompteAdherent(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[], int *nbAdherents, int taillePhysique)
void GestionCompteAdherent(int tabNoCarte[], int tabEtatCarte[], int tabPointCarte[], int nbAdherents)
{
int actif = 1;
int choix, cible;
char trash;
cible = CibleAdherent(tabNoCarte, nbAdherents); // Numéro de la carte de l'adhérent que l'on va traiter
while(actif)
{
choix = AffichageGestionAdherent();
choix = AffichageGestionCompteAdherent(cible);
switch(choix)
{
case 0 : actif = 0; break;
case 1 : cible = CibleInfosAdherent(); AfficheInfosAdherent(cible, tabNoCarte, tabEtatCarte, tabPointCarte, *nbAdherents);break;
case 2 : CreerAdherent(tabNoCarte, tabEtatCarte, tabPointCarte, nbAdherents, taillePhysique);break;
case 3 : SupprimerAdherent(nbAdherents, tabNoCarte, tabEtatCarte, tabPointCarte);break;
case 1 : AfficheInfosAdherent(cible, tabNoCarte, tabEtatCarte, tabPointCarte, nbAdherents); wait break;
case 2 : RechargeCarte(cible, tabNoCarte, tabEtatCarte, tabPointCarte, nbAdherents); break;
case 3 : actif = 0/*code temporaire à remplacer par Appel de la fontion Activation/Desactivation de la carte*/; break;
case 4 : cible = CibleAdherent(tabNoCarte, nbAdherents); break;
default :
clean
AfficheBandeauGCA();
printf("\nChoix invalide.\n");
printf("Appuyez sur entree pour continuer...");
scanf("%c", &trash);
wait
}
}
}
/**
* @brief Récupère le numéro de carte de l'adhérent pour lequel on souhaite obtenir les informations
* @brief Récupère le numéro de carte de l'adhérent à traiter
*
* @return int Numéro de carte de l'adhérent cible
*/
int CibleInfosAdherent(void)
int CibleAdherent(int tabNoCarte[], int nbAdherents)
{
int cible;
int trouve = 0;
int indice = 0;
clean
printf("Numero de carte de l'adherent : ");
while(!trouve)
{
AfficheBandeauGCA();
if(indice == -1)
{
printf("\nNumero de l'adherent inexistant.");
}
printf("\nNumero de carte de l'adherent a traiter : ");
scanf("%d", &cible);
indice = TrouverAdherent(tabNoCarte, nbAdherents, cible, &trouve);
clean
}
return cible;
}
/**
* @brief Affichage du bandeau du menu GestionCompteAdherent
*
*/
void AfficheBandeauGCA(void)
{
clean
printf("===============================================================\n");
printf("\t\tMENU GESTION D'UN COMPTE ADHERENT\n");
printf("===============================================================\n");
}
Loading…
Cancel
Save