reparation de la fonction supprimerCandidature

master
Siwa12100 2 years ago
parent 6140d22be7
commit 370c32992c

@ -135,6 +135,7 @@ void afficherUnCandidat(Candidat candidat);
void afficherCandidats(Candidat **candidats, int nbCandidats);
int creerCandidat(Candidat *tCand[], int nbCandidats);
lChoix supprimerCandidature( lChoix l, int nbchoix);
lChoix supprmRecru( lChoix l, int rep );
lChoix creerCandidature(lChoix choixCandid, char ville[50], char departement[50], int decision, int validation);
ListeDeptV2 configurationDeptV2( ListeDept ldept );

@ -127,7 +127,7 @@ bool vide(ListeDept ldept)
int longueur(ListeDept ldept)
{
int i = 0;
while (ldept)
while (ldept)
{
ldept = ldept->suiv;
i++;

@ -799,7 +799,7 @@ 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;
@ -821,15 +821,22 @@ lChoix supprimerCandidature( lChoix l, int nbchoix)
printf(" \n\n --> Quel choix supprimer ? : ");
scanf("%d%*c", &rep);
temp = supprmRecru( temp, rep );
while ( c != rep - 1 )
return temp;
}
lChoix supprmRecru( lChoix l, int rep )
{
if ( rep == 1 )
{
temp = temp -> suiv;
c = c + 1;
l = supprimerEnTeteC( l );
return l;
}
temp = supprimerEnTeteC( temp );
return temp;
l -> suiv = supprmRecru( l -> suiv, rep -1 );
return l;
}
/**

@ -45,21 +45,34 @@ void guillaume(void)
char ville[50], departement[50];
nbCandidats = creerCandidat(tCandid, nbCandidats);
printf("Nom de la ville : ");
scanf("%s%*c", ville);
printf("Nom du departement : ");
scanf("%s%*c", departement);
tCandid[0]->lchoix = creerCandidature(tCandid[0]->lchoix, ville, departement, 0, 0);
tCandid[0]->nbChoix +=1 ;
printf("Nom de la ville : ");
scanf("%s%*c", ville);
printf("Nom du departement : ");
scanf("%s%*c", departement);
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] -> lchoix = supprimerCandidature(tCandid[0]->lchoix, tCandid[0]->nbChoix);
tCandid[0]->nbChoix-=1;
//tCandid[0] -> lchoix = supprmRecru ( tCandid[0] -> lchoix, 1);
printf(" ( temporaire( 4 )... --> %s \n\n", tCandid[0] -> lchoix -> ville);
afficherUnCandidat(*tCandid[0]);
}

Loading…
Cancel
Save