From 8669fa946b003d2d77fe3ebe8a695cdd831f41b3 Mon Sep 17 00:00:00 2001 From: lolax Date: Thu, 12 Jan 2023 10:57:53 +0100 Subject: [PATCH] =?UTF-8?q?petit=20num=C3=A9ro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- part3.c | 18 ++++++++++++------ part3.h | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/part3.c b/part3.c index 230e5af..07308f8 100644 --- a/part3.c +++ b/part3.c @@ -59,7 +59,7 @@ Listecand InsertT(Listecand list, Candidat c)//Insert en tête de la liste c1->cand.moyfr = c.moyfr; c1->cand.moyen = c.moyen; c1->cand.moyspe = c.moyspe; - c1->cand.noteDoss = c.noteDoss; + c1->cand.noteDoss = c.noteDoss; c1->cand.nbchx = c.nbchx; c1->cand.lchx = c.lchx; c1->suivcand = list; @@ -176,7 +176,7 @@ Listecand AcceptedOrWait(Listecand lC, int *nbC, float noteMin)//créée une lis } -void MajDecJury(Listecand lC, int nbC, int nbAcc) +void MajDecJury(Listecand lC, int nbC, int nbAcc, int *nbCacc, int *nbCW) { int cpt; if (nbC > nbAcc)//si le nombre de candidats est supérieur ou égal au nombre max de personnes mises en "accepté" @@ -188,6 +188,7 @@ void MajDecJury(Listecand lC, int nbC, int nbAcc) iutclinf->chx.dec = 1; lC = lC->suivcand; } + *nbCacc = cpt; for (cpt; cpt < nbC; cpt ++)//la liste d'attente { Listechx iutclinf; @@ -195,6 +196,7 @@ void MajDecJury(Listecand lC, int nbC, int nbAcc) iutclinf->chx.dec = 2; lC = lC->suivcand; } + *nbCW = nbC - *nbCacc; } else { @@ -205,6 +207,8 @@ void MajDecJury(Listecand lC, int nbC, int nbAcc) iutclinf->chx.dec = 1; lC = lC->suivcand; } + *nbCacc = nbC; + *nbCW = 0; } } @@ -312,8 +316,8 @@ void RespAdmin(void)//fonction dédiée au responsable d'admission printf("Quel est le nombre de places disponibles ?\nNombre de places :\t"); scanf("%d", &nbP);//on récupère le nombre qu'il peut y avoir d'acceptés pour savoir qui sera accepté et qui sera en attente - - MajDecJury(lC, nbC, nbP);//fonction qui maj dec du jury + int nbCacc, nbCW; + MajDecJury(lC, nbC, nbP, &nbCacc, &nbCW);//fonction qui maj dec du jury lCAcc = splitAccepted(lC);//la liste des acceptés lCW = splitWait(lC);//la liste d'attente @@ -324,10 +328,12 @@ void RespAdmin(void)//fonction dédiée au responsable d'admission fA = fopen("partAcc.don", "w");//ouverture du fichier de sauvegarde des acceptés if (fA == NULL){printf("pb ouv fichier acc\n"); exit(-1);} + fprintf(fA, "%d\n", nbCacc); fW = fopen("partWait.don", "w");//ouverture du fichier de sauvegarde de l'attente if (fW == NULL){printf("pb ouv fichier wait\n"); exit(-1);} - + fprintf(fW, "%d\n", nbCW); + saveC(lCAcc, fA);//sauvegarde des acceptés saveC(lCW, fW);//sauvegarde de l'attente @@ -484,4 +490,4 @@ printf(" On en a tenté un autre pour vous -*/ \ No newline at end of file +*/ diff --git a/part3.h b/part3.h index 43484fb..ea29f34 100644 --- a/part3.h +++ b/part3.h @@ -52,7 +52,7 @@ void AffC(Candidat c); void AffCh(Choix c); void AffListeCandidat (Listecand l); void AffListChoix(Listechx l); -void MajDecJury(Listecand lC, int nbC, int nbAcc);//mise à jour de la décision du jury +void MajDecJury(Listecand lC, int nbC, int nbAcc, int *nbCacc, int *nbCW);//mise à jour de la décision du jury Listecand searchCand(Listecand lC, char *nom, char *prenom);//recherche d'un candidat par son nom et prénom Listecand MajNote(Listecand lC, char *nom, char *prénom, float newNote);//mise à jour de la note de dossier du candidat Listecand splitAccepted(Listecand origin);//fonction qui retourne la liste des admis