From 7764dc274753fae00b613b01e2687d08f03b80d5 Mon Sep 17 00:00:00 2001 From: allaurent13 Date: Fri, 13 Jan 2023 11:32:31 +0000 Subject: [PATCH] SAE.c correction fonction ajouterCandid --- SAE.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/SAE.c b/SAE.c index aae4da2..6dc92d1 100644 --- a/SAE.c +++ b/SAE.c @@ -85,6 +85,7 @@ int menuUtilisateurAffiche(void) printf("6 - Consultation de tout les IUT ayant un département choisi\n"); printf("7 - Consultation de toute les informations des Département par IUT\n"); printf("8 - Mode Candidat\n"); + printf("11 - Mode Responsable\n"); printf("\n\n9 - Connexion mode Administrateur\n"); printf("\n\n10 - Quitter\n"); printf("####################################################\n"); @@ -165,6 +166,7 @@ void gestionMenu(VilleIUT **tiut, int nbEle, Candidat **tcandid, int *nbCandid, if (verifQuit()) { SauvegarderIUT(tiut, nbEle); + SauvegardeCandid(tcandid, *nbCandid); return; } break; @@ -444,15 +446,16 @@ void creationDept(VilleIUT **tiut, int nbEle) while(1) { printf("Nom du Département : "); - scanf("%s", code); + scanf("%s%*c", code); aux = rechercheDept(tiut[pos]->idDept, code); if (aux != NULL) printf("Département déjà existant\n"); if (aux == NULL) { - printf("Nom du Responsable du Département de %s : ",code); + printf("Nom du Responsable du Département %s : ",code); fgets(nom,30,stdin); nom[strlen(nom)-1] = '\0'; + printf("%s\n", nom); printf("Nombre de place du Département %s : ",code); scanf("%d", &nbP); tiut[pos]->idDept = insererDept(tiut[pos]->idDept,code,nom,nbP); @@ -990,6 +993,7 @@ void creationCandid(VilleIUT **tiut, int nbIUT, Candidat **tcandid, int *nbCandi strcpy(c.nom, nom); strcpy(c.prenom, prenom); c.idCandIUT = ListeCandidvide(); + tcandid[*nbCandid] = (Candidat *)malloc(sizeof(Candidat)); *nbCandid = *nbCandid + 1; *(tcandid[*nbCandid - 1]) = c; printf("création terminer \n"); @@ -1156,6 +1160,12 @@ void ajouterDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, i char ville[30], departement[30]; int pos,irech, trouve; MaillonCandid *aux; + aux = (MaillonCandid *)malloc(sizeof(MaillonCandid)); + if (aux == NULL) + { + printf("Erreur Malloc ! \n"); + exit(1); + } ChoixDept **tDept; while(1) { @@ -1185,11 +1195,12 @@ void ajouterDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, i } *(tDept[0]) = RempTabCandid(departement, 0, 0); tcandid[iCandid]->idCandIUT = insererCandid(tcandid[iCandid]->idCandIUT, ville, tDept, 1); + printf("Candidature Validée \n"); } else { irech = recherchecandidDept(aux->tabDept, aux->nbChoix, departement, &trouve); - if (trouve == 0) + if (irech == -1) { *(aux->tabDept[aux->nbChoix]) = RempTabCandid(departement, 0, 0); aux->nbChoix = aux->nbChoix + 1; @@ -1200,7 +1211,7 @@ void ajouterDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, i } } printf("saisie Département\n"); - if(verifSelection()) + if(!verifSelection()) break; } } @@ -1208,6 +1219,7 @@ void ajouterDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, i if(!verifSelection()) break; } + free(aux); } void supprimerCandidDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, int iCandid)