diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index e9de19f..7162f46 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -10,6 +10,9 @@ void MenuUser(VilleIUT* lvIUT[],int tlogi) { + int quit=0; + while(!quit) + { int intUserEntry=0; printf("#--------------------------------------------------------------------#\n"); printf("| |\n"); @@ -23,16 +26,30 @@ void MenuUser(VilleIUT* lvIUT[],int tlogi) printf("4 : Rechercher les IUTs possèdant un département précis.\n"); printf("9 : Revenir à l'écran de sélection du profil.\n\n"); printf("#--------------------------------------------------------------------#\n\n"); - while(intUserEntry!=9) - { - printf("Choisissez l'action que vous voulez exécuter : "); - if (!(scanf("%d",intUserEntry)))printf("Entrée innexacte. Veuillez réessayer"); - if (intUserEntry==1) SearchCityWithIUT(lvIUT,tlogi); - if (intUserEntry==2) DepEachIUT(lvIUT,tlogi); - if (intUserEntry==3) SearchPlaceFromDepInIUT(lvIUT,tlogi); - if (intUserEntry==4) SearchIUTFromDep(lvIUT,tlogi); - if (intUserEntry==9) printf("Sortie en cours.\n"); - else printf("Entrée innexacte. Veuillez réessayer"); + int act; + scanf("%d",&act); + switch(act){ + case 1: + SearchCityWithIUT(lvIUT,tlogi); + reset(); + break; + case 2: + DepEachIUT(lvIUT,tlogi); + reset(); + break; + case 3: + SearchPlaceFromDepInIUT(lvIUT,tlogi); + reset(); + break; + case 4: + SearchIUTFromDep(lvIUT,tlogi); + reset(); + break; + case 9: + quit=1; + break; + + } } } @@ -167,7 +184,7 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){ printf("\n\nEntrez le département à modifier:"); char dep[31]; scanf("%*c%s",&dep); - if(!existeDep(tiut->ldept,dep)){ + if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; } @@ -228,7 +245,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){ printf("\n\nEntrez le département à supprimer:"); char dep[31]; scanf("%*c%s",&dep); - if(!existeDep(tiut->ldept,dep)){ + if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; } @@ -268,7 +285,7 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){ printf("\n\nEntrez le département à modifier:"); char dep[31]; scanf("%*c%s",&dep); - if(!existeDep(tiut->ldept,dep)){ + if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; } diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index 1cfa471..951a966 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -2,13 +2,13 @@ #include #include #include "saeP2.h" - +/* candidat* LoadCandid(void) { //J'ouvre le fichier FILE* file; - if((file=fopen(candid.bin,"wb")==NULL) + if((file=fopen("candid.bin","rb"))==NULL) { perror("Erreur : "); exit(1); @@ -42,8 +42,8 @@ candidat* LoadCandid(void) int vcand; fread(ville,sizeof(char)*31,1,file); fread(dep,sizeof(char)*31,1,file); - fread(ddep,sizeof(int),1,file); - fread(vcand,sizeof(int),1,file); + fread(&ddep,sizeof(int),1,file); + fread(&vcand,sizeof(int),1,file); voeu voeu_ajout; voeu_ajout.ville=ville; voeu_ajout.dep=dep; @@ -110,4 +110,4 @@ void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcand) } -//void gestionPhaseCandidatures(); A FAIRE. \ No newline at end of file +//void gestionPhaseCandidatures(); A FAIRE.*/ \ No newline at end of file