mise a jour affichage de candidats

master
Siwa12100 2 years ago
parent bd40c3c7bc
commit bcdeb24491

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

@ -701,22 +701,27 @@ void menuAdmin(VilleIut **villeIut, int nbVilles)
* @brief Affiche les informations d'un candidat * @brief Affiche les informations d'un candidat
* @param candidat Le candidat à afficher * @param candidat Le candidat à afficher
*/ */
/* void afficherCandidat(Candidat candidat) void afficherUnCandidat(Candidat candidat)
{ {
printf("Numéro du candidat : %d\n", candidat.numero); int c = 1;
printf("Nom : %s\n", candidat.nom); printf("Candidat numero %7d ", candidat.numero);
printf("Prénom : %s\n", candidat.prenom); printf(" | Nom : %10s | ", candidat.nom);
printf("Notes : %.2f %.2f %.2f %.2f\n", candidat.notes[0], candidat.notes[1], candidat.notes[2], candidat.notes[3]); printf(" Prenom : %10s | ", candidat.prenom);
printf("Nombre de choix : %d\n", candidat.nbChoix); printf(" | Notes : %2f %2f %2f %2f | ", candidat.notes[0], candidat.notes[1], candidat.notes[2], candidat.notes[3]);
for (int i = 0; i < candidat.nbChoix; i++) printf(" Nombre de choix : %d\n\n", candidat.nbChoix);
printf(" \n Choix du candidat :\n");
printf( " -------------------\n\n");
while ( candidat.lchoix != NULL )
{ {
printf("Choix %d :\n", i + 1); printf(" %d.) Iut : %10s ; departement : %10s ; decision Departement : %d ; validation candidat : %d\n",
printf(" Ville : %s\n", candidat.choix[i].ville); candidat.lchoix -> ville, candidat.lchoix -> departement, candidat.lchoix -> decisionDepartement,
printf(" Département : %s\n", candidat.choix[i].departement); candidat.lchoix -> validationCandidat);
printf(" Décision du département : %d\n", candidat.choix[i].decisionDepartement);
printf(" Validation : %d\n", candidat.choix[i].validationCandidat);
} }
} */
printf(" \n\n");
}
/** /**
* @brief Affiche la liste des candidats * @brief Affiche la liste des candidats
@ -724,68 +729,67 @@ void menuAdmin(VilleIut **villeIut, int nbVilles)
* @param candidats Le tableau de candidats à afficher * @param candidats Le tableau de candidats à afficher
* @param nbCandidats Le nombre de candidats dans le tableau * @param nbCandidats Le nombre de candidats dans le tableau
*/ */
/*void afficherCandidats(Candidat *candidats, int nbCandidats) void afficherCandidats(Candidat **candidats, int nbCandidats)
{ {
for (int i = 0; i < nbCandidats; i++) for (int i = 0; i < nbCandidats; i++)
{ printf("\nCandidat numero %8d | Nom : %10s | Prenom : %10s \n", candidats[i] -> numero,
printf("\nCandidat %d :\n", i + 1); candidats[i] -> nom, candidats[i] -> prenom);
afficherCandidat(candidats[i]);
}
} }
int creerCandid(Candidat tCand[], int nbCandidats)
{
int i=0;
Candidat c;
printf("Rentrez le numéro du candidat :"); // int creerCandid(Candidat tCand[], int nbCandidats)
scanf("%d%*c",&c.numero); // {
while(i<nbCandidats) // int i=0;
{ // Candidat c;
if(c.numero==tCand[i].numero)
{ // printf("Rentrez le numéro du candidat :");
printf("Ce numéro existe déjà, veuillez en rentrer un nouveau :"); // scanf("%d%*c",&c.numero);
scanf("%d%*c",&c.numero); // while(i<nbCandidats)
i=0; // {
} // if(c.numero==tCand[i].numero)
i = i + 1; // {
} // printf("Ce numéro existe déjà, veuillez en rentrer un nouveau :");
printf("Nom du candidat (peut contenir des espaces): "); // scanf("%d%*c",&c.numero);
fgets(c.nom, 50, stdin); // i=0;
c.nom[strlen(c.nom) - 1] = '\0'; // }
printf("Prénom du candidat (peut contenir des espaces): "); // i = i + 1;
fgets(c.prenom, 50, stdin); // }
c.prenom[strlen(c.prenom) - 1] = '\0'; // printf("Nom du candidat (peut contenir des espaces): ");
i=0; // fgets(c.nom, 50, stdin);
while(i<4) // c.nom[strlen(c.nom) - 1] = '\0';
{ // printf("Prénom du candidat (peut contenir des espaces): ");
printf("Rentrez une note : "); // fgets(c.prenom, 50, stdin);
scanf("%f", &c.notes[i]); // c.prenom[strlen(c.prenom) - 1] = '\0';
printf("%f", c.notes[i]); // i=0;
i = i + 1; // while(i<4)
} // {
printf("Nombre de choix de candidatures : "); // printf("Rentrez une note : ");
scanf("%d%*c", &c.nbChoix); // scanf("%f", &c.notes[i]);
c.nbChoix = (Choix *) malloc (c.nbChoix*sizeof(Choix)); // printf("%f", c.notes[i]);
if(c.nbChoix==NULL) // i = i + 1;
{ // }
printf("Problème malloc\n"); // printf("Nombre de choix de candidatures : ");
exit(1); // scanf("%d%*c", &c.nbChoix);
} // c.nbChoix = (Choix *) malloc (c.nbChoix*sizeof(Choix));
i=0; // if(c.nbChoix==NULL)
while(i<c.nbChoix) // {
{ // printf("Problème malloc\n");
printf("Rentrez la ville souhaitée : "); // exit(1);
scanf("%s%*c", c.choix[i].ville); // }
printf("Rentrez le département souhaité : "); // i=0;
scanf("%s%*c", c.choix[i].departement); // while(i<c.nbChoix)
c.choix[i].decisionDepartement = 0; // {
c.choix[i].validationCandidat = 0; // printf("Rentrez la ville souhaitée : ");
i = i + 1; // scanf("%s%*c", c.choix[i].ville);
} // printf("Rentrez le département souhaité : ");
printf("%d %s %s %f %d %s %s %d", c.numero, c.nom, c.prenom, c.notes[1], c.nbChoix, c.choix[0].ville, c.choix[0].departement, c.choix[0].decisionDepartement, c.choix[0].validationCandidat); // scanf("%s%*c", c.choix[i].departement);
return nbCandidats + 1; // c.choix[i].decisionDepartement = 0;
} // c.choix[i].validationCandidat = 0;
// i = i + 1;
// }
// printf("%d %s %s %f %d %s %s %d", c.numero, c.nom, c.prenom, c.notes[1], c.nbChoix, c.choix[0].ville, c.choix[0].departement, c.choix[0].decisionDepartement, c.choix[0].validationCandidat);
// return nbCandidats + 1;
// }
/* /*

Loading…
Cancel
Save