SAE.c correction fonction ajouterCandid

master
Alexis LAURENT 2 years ago
parent 1384a8fe84
commit 7764dc2747

20
SAE.c

@ -85,6 +85,7 @@ int menuUtilisateurAffiche(void)
printf("6 - Consultation de tout les IUT ayant un département choisi\n"); 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("7 - Consultation de toute les informations des Département par IUT\n");
printf("8 - Mode Candidat\n"); printf("8 - Mode Candidat\n");
printf("11 - Mode Responsable\n");
printf("\n\n9 - Connexion mode Administrateur\n"); printf("\n\n9 - Connexion mode Administrateur\n");
printf("\n\n10 - Quitter\n"); printf("\n\n10 - Quitter\n");
printf("####################################################\n"); printf("####################################################\n");
@ -165,6 +166,7 @@ void gestionMenu(VilleIUT **tiut, int nbEle, Candidat **tcandid, int *nbCandid,
if (verifQuit()) if (verifQuit())
{ {
SauvegarderIUT(tiut, nbEle); SauvegarderIUT(tiut, nbEle);
SauvegardeCandid(tcandid, *nbCandid);
return; return;
} }
break; break;
@ -444,15 +446,16 @@ void creationDept(VilleIUT **tiut, int nbEle)
while(1) while(1)
{ {
printf("Nom du Département : "); printf("Nom du Département : ");
scanf("%s", code); scanf("%s%*c", code);
aux = rechercheDept(tiut[pos]->idDept, code); aux = rechercheDept(tiut[pos]->idDept, code);
if (aux != NULL) if (aux != NULL)
printf("Département déjà existant\n"); printf("Département déjà existant\n");
if (aux == NULL) 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); fgets(nom,30,stdin);
nom[strlen(nom)-1] = '\0'; nom[strlen(nom)-1] = '\0';
printf("%s\n", nom);
printf("Nombre de place du Département %s : ",code); printf("Nombre de place du Département %s : ",code);
scanf("%d", &nbP); scanf("%d", &nbP);
tiut[pos]->idDept = insererDept(tiut[pos]->idDept,code,nom,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.nom, nom);
strcpy(c.prenom, prenom); strcpy(c.prenom, prenom);
c.idCandIUT = ListeCandidvide(); c.idCandIUT = ListeCandidvide();
tcandid[*nbCandid] = (Candidat *)malloc(sizeof(Candidat));
*nbCandid = *nbCandid + 1; *nbCandid = *nbCandid + 1;
*(tcandid[*nbCandid - 1]) = c; *(tcandid[*nbCandid - 1]) = c;
printf("création terminer \n"); 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]; char ville[30], departement[30];
int pos,irech, trouve; int pos,irech, trouve;
MaillonCandid *aux; MaillonCandid *aux;
aux = (MaillonCandid *)malloc(sizeof(MaillonCandid));
if (aux == NULL)
{
printf("Erreur Malloc ! \n");
exit(1);
}
ChoixDept **tDept; ChoixDept **tDept;
while(1) while(1)
{ {
@ -1185,11 +1195,12 @@ void ajouterDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, i
} }
*(tDept[0]) = RempTabCandid(departement, 0, 0); *(tDept[0]) = RempTabCandid(departement, 0, 0);
tcandid[iCandid]->idCandIUT = insererCandid(tcandid[iCandid]->idCandIUT, ville, tDept, 1); tcandid[iCandid]->idCandIUT = insererCandid(tcandid[iCandid]->idCandIUT, ville, tDept, 1);
printf("Candidature Validée \n");
} }
else else
{ {
irech = recherchecandidDept(aux->tabDept, aux->nbChoix, departement, &trouve); irech = recherchecandidDept(aux->tabDept, aux->nbChoix, departement, &trouve);
if (trouve == 0) if (irech == -1)
{ {
*(aux->tabDept[aux->nbChoix]) = RempTabCandid(departement, 0, 0); *(aux->tabDept[aux->nbChoix]) = RempTabCandid(departement, 0, 0);
aux->nbChoix = aux->nbChoix + 1; 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"); printf("saisie Département\n");
if(verifSelection()) if(!verifSelection())
break; break;
} }
} }
@ -1208,6 +1219,7 @@ void ajouterDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, i
if(!verifSelection()) if(!verifSelection())
break; break;
} }
free(aux);
} }
void supprimerCandidDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, int iCandid) void supprimerCandidDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, int iCandid)

Loading…
Cancel
Save