diff --git a/iut.h b/iut.h index a1c0354..a1e2cc9 100644 --- a/iut.h +++ b/iut.h @@ -52,6 +52,7 @@ typedef enum {faux,vrai}Booleen; int rechercheIUT(VilleIUT *tiut[],int n); int rechercheDept(VilleIUT *tiut[], int n); int recherchePlaces(VilleIUT *tiut[], int n); + int rechercheMixed(VilleIUT *tiut[], int n); //Menu administrateur : void MenuAdministrateur(VilleIUT *tiut[],int n); diff --git a/utilisateurIut.c b/utilisateurIut.c index 88db3c1..a3d9575 100644 --- a/utilisateurIut.c +++ b/utilisateurIut.c @@ -19,7 +19,7 @@ void MenuUtilisateur(VilleIUT *tiut[], int n){ succes = recherchePlaces(tiut, n); } if(choix==4){ - // + succes = rechercheMixed(tiut, n); } if(choix==5){ return; @@ -89,3 +89,33 @@ int recherchePlaces(VilleIUT *tiut[], int n){ } return 1; } + +int rechercheMixed(VilleIUT *tiut[], int n){ + char rech[31], rech2[31]; + int i, trouve = 0, j = 0; + ListeD ld; + printf("\nEntrez le nom d'une ville : "); + scanf("%s%*c", &rech); + printf("\nEntrez le nom du département souhaité : "); + scanf("%s%*c", &rech2); + for(i=0;ildept; + if(strcmp(tiut[i]->ville, rech)==0){ + while(ld!=NULL){ + if(strcmp(ld->departement, rech2)==0){ + printf("\nÀ %s :\n", tiut[i]->ville); + printf("%s\t", ld->departement); + printf("Nombre de places : %d\n",ld->nbP); + printf("Responsable : %s\n",ld->resp); + trouve = 1; + } + else if(i==n-1) + printf("\nAucun département trouvé.\n"); + ld = ld->suivant; + } + } + else if(i==n-1) + printf("\nAucun département trouvé pour la ville correspondante.\n"); + } + return 1; +} \ No newline at end of file