diff --git a/header/sae.h b/header/sae.h index fc1b9fc..47bf29e 100644 --- a/header/sae.h +++ b/header/sae.h @@ -134,6 +134,7 @@ void menuAdmin(VilleIut *tiut[], int nbVilles); void afficherUnCandidat(Candidat candidat); void afficherCandidats(Candidat **candidats, int nbCandidats); int creerCandidat(Candidat *tCand[], int nbCandidats); +lChoix supprimerCandidature( lChoix l, int nbchoix); lChoix creerCandidature(lChoix choixCandid, char ville[50], char departement[50], int decision, int validation); ListeDeptV2 configurationDeptV2( ListeDept ldept ); diff --git a/source/main.c b/source/main.c index 44200a6..184f5ca 100644 --- a/source/main.c +++ b/source/main.c @@ -8,9 +8,9 @@ int main(void) // #ifdef _WIN32 // color // #endif - //guillaume(); + guillaume(); //testCharge(); - Globale(); + //Globale(); //testJean(); return 0; diff --git a/source/sae.c b/source/sae.c index 4973d53..f0b21b1 100644 --- a/source/sae.c +++ b/source/sae.c @@ -799,8 +799,10 @@ int creerCandidat(Candidat *tCand[], int nbCandidats) * * @return la liste avec le choix en moins */ -lChoix supprimerCandidature( lChoix l, int * nbchoix) +lChoix supprimerCandidature( lChoix l, int nbchoix) { + lChoix temp = l; + if ( l == NULL ) { printf(" \n --> Le candidat ne possede aucun choix...\n\n"); @@ -811,9 +813,10 @@ lChoix supprimerCandidature( lChoix l, int * nbchoix) printf( " -----------------------------\n\n"); int rep = 0, c = 0; - for( int i = 0; i < *nbchoix; i ++ ) + for( int i = 0; i < nbchoix; i ++ ) { printf(" %d.) Ville : %10s ; Departement : %10s \n",i + 1, l -> ville, l -> departement); + l = l -> suiv; } printf(" \n\n --> Quel choix supprimer ? : "); @@ -821,13 +824,12 @@ lChoix supprimerCandidature( lChoix l, int * nbchoix) while ( c != rep - 1 ) { - l = l -> suiv; + temp = temp -> suiv; c = c + 1; } - l = supprimerEnTeteC( l ); - *nbchoix = *nbchoix - 1; - return l; + temp = supprimerEnTeteC( temp ); + return temp; } /** diff --git a/source/test.c b/source/test.c index fbfa71f..888664e 100644 --- a/source/test.c +++ b/source/test.c @@ -58,6 +58,9 @@ void guillaume(void) tCandid[0]->lchoix = creerCandidature(tCandid[0]->lchoix, ville, departement, 0, 0); tCandid[0]->nbChoix +=1 ; afficherUnCandidat(*tCandid[0]); + supprimerCandidature(tCandid[0]->lchoix, tCandid[0]->nbChoix); + tCandid[0]->nbChoix-=1; + afficherUnCandidat(*tCandid[0]); }