fonction creerCandidat + affichage qui marche youpi

master
Guillaume 2 years ago
parent 723a412eae
commit 5537943d70

@ -131,15 +131,9 @@ void afficheNbPlacesDep(VilleIut *tiut[], int nbVilles, char nomDept[]);
int existeVille( VilleIut *tiut[], char ville[], int nbvilles );
void menuAdmin(VilleIut *tiut[], int nbVilles);
<<<<<<< HEAD
void afficherCandidat(Candidat candidat);
void afficherCandidats(Candidat *candidats, int nbCandidats);
int creerCandidat(Candidat *tCand[], int nbCandidats);
=======
void afficherUnCandidat(Candidat candidat);
void afficherCandidats(Candidat **candidats, int nbCandidats);
int creerCandid(Candidat tCand[], int nbCandidats);
>>>>>>> bcdeb24491974b30c7e1ad6913f0e3fa2c3be9c3
int creerCandidat(Candidat *tCand[], int nbCandidats);
ListeDeptV2 configurationDeptV2( ListeDept ldept );

@ -732,8 +732,10 @@ void menuAdmin(VilleIut **villeIut, int nbVilles)
void afficherCandidats(Candidat **candidats, int nbCandidats)
{
for (int i = 0; i < nbCandidats; i++)
{
printf("\nCandidat numero %8d | Nom : %10s | Prenom : %10s \n", candidats[i] -> numero,
candidats[i] -> nom, candidats[i] -> prenom);
}
}
@ -748,7 +750,7 @@ int creerCandidat(Candidat *tCand[], int nbCandidats)
printf("Probleme malloc\n");
exit(1);
}
c->numero = nbCandidats;
c->numero = nbCandidats+1;
printf("Le numero du candidat entrain d'etre cree est : %d\n", c->numero);
printf("Nom du candidat (peut contenir des espaces): ");
fgets(c->nom, 50, stdin);

@ -41,10 +41,11 @@
void guillaume(void)
{
Candidat *tCandid[50];
int nbCandidats=2;
int nbCandidats=0;
nbCandidats = creerCandidat(tCandid, nbCandidats);
printf("\n%d\n", nbCandidats);
afficherCandidats(tCandid, nbCandidats);
}

Loading…
Cancel
Save