diff --git a/SAE.h b/SAE.h index b464700..06a45a9 100755 --- a/SAE.h +++ b/SAE.h @@ -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/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