diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 4abac9b..3a135b5 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -3,3 +3,69 @@ #include #include "saeP1.h" +void SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi) +{ + for (int i=0;iVille); +} + +void DepEachIUT(VilleIUT* lvIUT[], int tlogi) +{ + for (int i=0;ildept; + while (MaillonAct!=NULL) printf("%s",MaillonAct->departement); + } +} + +void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi) +{ + char sVille[31]; + char sDep[31]; + int boolF=0, i; + printf("Entrez le nom de la ville contenant le département recherché :\n"); + scanf("%s",sVille); + printf("Département y étant disponible :\n"); + for (i=0;iVille==sVille) + { + MaillonDep* MaillonAct=lvIUT[i]->ldept; + while (MaillonAct!=NULL) printf("%s",MaillonAct->departement); + boolF=1; + MaillonAct=MaillonAct->suivant; + break; + } + } + if (!boolF) + { + printf("La ville n'est pas dans la liste.\nMerci de vérifier l'orthographe.\n"); + return; + } + printf("Entrez le nom du département dont vous souhaitez connaitre le nombre de place\n"); + scanf("%s",sDep); + MaillonDep* MaillonAct=lvIUT[i]->ldept; + while (MaillonAct!=NULL) + { + + if(MaillonAct->departement==sDep) + { + printf("Nombre de place : %d\n",MaillonAct->nbp); + return; + } + MaillonAct=MaillonAct->suivant; + } + printf("Le département n'est pas dans la liste.\nMerci de vérifier l'orthographe.\n"); +} + +void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi) +{ + char sDep[31]; + printf("Merci de renseignez le département dont vous cherchez les IUTs :\n"); + scanf("%s",sDep); + + for (int i=0;ildept; + if(MaillonAct->departement==sDep) printf("%s",lvIUT[i]->Ville); + } +} \ No newline at end of file diff --git a/src/partie1/saeP1.h b/src/partie1/saeP1.h index 3cf87cf..281938c 100644 --- a/src/partie1/saeP1.h +++ b/src/partie1/saeP1.h @@ -16,13 +16,13 @@ typedef struct //User -void SearchCityWithIUT(); +void SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi); -void DepEachIUT(); +void DepEachIUT(VilleIUT* lvIUT[], int tlogi); -void DelDepFromIUT(); +void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi); -void SearchDepInIUT(); +void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi); //Admin