diff --git a/src/annexe/saeAnnexe.c b/src/annexe/saeAnnexe.c index 56c7391..b4c8b3d 100644 --- a/src/annexe/saeAnnexe.c +++ b/src/annexe/saeAnnexe.c @@ -61,7 +61,6 @@ int loadIUT(VilleIUT** tiut){ int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){ if(!lTab){ - fprintf(stderr,"Erreur, Pas de villes enregistrées !\n"); return -1; } for(int i=0; iVille,sVille)) { - printf("Département y étant disponible :\n"); + printf("\nDépartement y étant disponible :\n"); MaillonDep* MaillonAct=lvIUT[i]->ldept; while (MaillonAct!=NULL) { @@ -104,10 +104,10 @@ void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi) } if (!boolF) { - printf("La ville n'est pas dans la liste.\nMerci de vérifier l'orthographe.\n"); + printf("\nLa 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"); + printf("\nEntrez 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) @@ -115,24 +115,27 @@ void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi) if(!strcmp(MaillonAct->departement,sDep)) { - printf("Nombre de place : %d\n",MaillonAct->nbp); + printf("\nNombre 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"); + printf("\nLe 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"); + printf("\nMerci de renseignez le département dont vous cherchez les IUTs :\n"); scanf("%s",sDep); - + printf("\nVoici la liste des IUTs contenant le département mentionné :\n\n"); for (int i=0;ildept; - if(!strcmp(MaillonAct->departement,sDep)) printf("\t-%s",lvIUT[i]->Ville); + while(MaillonAct!=NULL){ + if(!strcmp(MaillonAct->departement,sDep)) printf("\t-%s\n",lvIUT[i]->Ville); + MaillonAct=MaillonAct->suivant; + } } } @@ -193,17 +196,17 @@ void menuAdmin(VilleIUT* tiut[],int *tlogi){ void modifPlaces(VilleIUT* tiut[],int tlogi){ printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",ville); + scanf("%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; int noVille=rechercheIUT(tiut,tlogi,ville); - if(noVille<=0){ + if(noVille<0){ fprintf(stderr,"\nVille non existante !\n"); return; } VilleIUT* v=tiut[noVille]; - printf("\n\nEntrez le département à modifier:"); + printf("\n\nEntrez le département à modifier :"); char dep[31]; - scanf("%*c%s",dep); + scanf("%s",dep); if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; @@ -221,7 +224,7 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){ void creerDep(VilleIUT* tiut[],int tlogi){ printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",ville); + scanf("%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; int noVille=rechercheIUT(tiut,tlogi,ville); if(noVille<0){ @@ -262,17 +265,17 @@ void creerDep(VilleIUT* tiut[],int tlogi){ void supprimerDep(VilleIUT* tiut[],int tlogi){ printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",ville); + scanf("%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; int noVille=rechercheIUT(tiut,tlogi,ville); - if(noVille<=0){ + if(noVille<0){ fprintf(stderr,"\nVille non existante !\n"); return; } VilleIUT* v=tiut[noVille]; printf("\n\nEntrez le département à supprimer:"); char dep[31]; - scanf("%*c%s",dep); + scanf("%s",dep); if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; @@ -304,17 +307,17 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){ void modifNomResponsable(VilleIUT* tiut[],int tlogi){ printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",ville); + scanf("%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; int noVille=rechercheIUT(tiut,tlogi,ville); - if(noVille<=0){ + if(noVille<0){ fprintf(stderr,"\nVille non existante !\n"); return; } VilleIUT* v=tiut[noVille]; printf("\n\nEntrez le département à modifier:"); char dep[31]; - scanf("%*c%s",dep); + scanf("%s",dep); if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; @@ -335,7 +338,7 @@ void creerIUT(VilleIUT* tiut[],int* tlogi){ scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; int noVille=rechercheIUT(tiut,*tlogi,ville); - if(noVille>0){ + if(noVille>=0){ fprintf(stderr,"\nVille déjà existante !\n"); return; }