diff --git a/SAE.h b/SAE.h index 401d894..c209a93 100755 --- a/SAE.h +++ b/SAE.h @@ -5,9 +5,9 @@ #include "structures.h" /* Menus */ -void choixMenu(void); -void menuUtilisateur(void); -void menuAdministrateur(void); +void choixMenu(ListeDept *tiut[]); +void menuUtilisateur(ListeDept *tiut[]); +void menuAdministrateur(ListeDept *tiut[]); /* Partie 1 */ ListeDept listenouv(void); @@ -19,6 +19,7 @@ void afficherDept(ListeDept l); int rechercheDept(ListeDept l, char departement[], bool *trouve); ListeDept supprimerEnTete(ListeDept l); ListeDept supprimer(ListeDept l, char departement[]); +int longueur(ListeDept l); int getNbP(ListeDept l, int pos); void setNbP(ListeDept l, int pos, int valeur); diff --git a/exe b/exe index 23a11fb..1e1cebf 100755 Binary files a/exe and b/exe differ diff --git a/global.c b/global.c index 5ba7d09..8532777 100755 --- a/global.c +++ b/global.c @@ -2,5 +2,6 @@ void global(void) { + } diff --git a/menus.c b/menus.c index 3fbea0b..b6695c6 100755 --- a/menus.c +++ b/menus.c @@ -1,6 +1,6 @@ #include "SAE.h" -void choixMenu(void) +void choixMenu(ListeDept *tiut[]) { int choix; bool c = false; @@ -17,11 +17,11 @@ void choixMenu(void) { case 1: c = true; - menuUtilisateur(); + menuUtilisateur(tiut); break; case 2: c = true; - menuAdministrateur(); + menuAdministrateur(tiut); break; case 9: c = true; @@ -33,7 +33,7 @@ void choixMenu(void) } } -void menuUtilisateur(void) +void menuUtilisateur(ListeDept *tiut[]) { int choix; bool c = false; @@ -68,7 +68,7 @@ void menuUtilisateur(void) break; case 9: c = true; - return choixMenu(); + return choixMenu(tiut); default: printf("Option non reconnue. Veuillez recommencer.\n"); break; @@ -76,7 +76,7 @@ void menuUtilisateur(void) } } -void menuAdministrateur(void) +void menuAdministrateur(ListeDept *tiut[]) { int choix; bool c = false; @@ -120,7 +120,7 @@ void menuAdministrateur(void) // break; case 9: - return choixMenu(); + return choixMenu(tiut); break; default: printf("Option non reconnue. Veuillez recommencer.\n"); diff --git a/structuresP1.c b/structuresP1.c index 0e02dea..4b6db95 100644 --- a/structuresP1.c +++ b/structuresP1.c @@ -163,4 +163,13 @@ char* getDept(ListeDept l, int pos) l = l->suiv; } return l->departement; +} + +int longueur(ListeDept l) +{ + if (vide(l)) + { + return 0; + } + return 1 + longueur(l->suiv); } \ No newline at end of file diff --git a/utilisateur.c b/utilisateur.c index f2849dc..10fc4ea 100644 --- a/utilisateur.c +++ b/utilisateur.c @@ -17,4 +17,17 @@ void affichageDeptIUT(VilleIUT *tiut[], int nb) printf("\t%s :\n", tiut[i]->ville); afficherDept(tiut[i]->ldept); } +} + +void affichageNbP(VilleIUT *tiut[], int nb) +{ + printf("Voici le nombre de places dans chaque département de chaque IUT :"); + for (int i = 0; i < nb; i++) + { + printf("\t%s :\n", tiut[i]->ville); + for (int v = 0; v < longueur(tiut[i]->ldept); v++) + { + printf("\t%s :\t%s", getDept(tiut[i]->ldept, v), getNbP(tiut[i]->ldept, v)); + } + } } \ No newline at end of file