From c08a162160af82f3f93d2aaab541778bb8fb9130 Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Fri, 13 Jan 2023 22:11:29 +0100 Subject: [PATCH] Ajustements. --- src/partie2/saeP2.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index 291ac9d..d2369db 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -27,7 +27,7 @@ candidat** LoadCandid(int* CandidOpen, int* nbcandid) { //Son numéro, Son nom, Son prenom, liste de note` Tabcandidat[i]=(candidat*)malloc(sizeof(candidat)); - if(Tabcandidat[i]==NULL){ + if(Tabcandidat[i]==NULL){ perror("malloc"); exit(errno); } @@ -175,19 +175,26 @@ void Candidater(VilleIUT* tiut[],int tlogi, candidat* tcandidat[], int nbcandida printf("Veuillez entrez le département dans lequel vous souhaitez y postuler : "); scanf("%s",DepRech); printf("Check !\n"); - if (existeDep(tiut[ind]->ldept, DepRech)==0) return; + if (existeDep(tiut[ind]->ldept, DepRech)==0){ + fprintf(stderr,"Erreur, le département n'existe pas."); + return; + } else { int i, numcandid; - printf("Veuillez entrez le numéro du candidat qui lui a été attribué : "); + printf("Veuillez entrez le numéro du candidat qui vous a été attribué : "); scanf("%d",&numcandid); for (i=0;tcandidat[i]->numcandid!=numcandid && iville,VilleRech); strcpy(voeu_ajout->dep,DepRech); voeu_ajout->ddep=0; voeu_ajout->vcand=0; - tcandidat[i]->TabVoeu[tcandidat[i]->nbchoix]=voeu_ajout; + tcandidat[i]->TabVoeu[tcandidat[i]->nbchoix-1]=voeu_ajout; tcandidat[i]->nbchoix++; }