|
|
|
@ -3,18 +3,55 @@
|
|
|
|
|
/* Partie 2 */
|
|
|
|
|
/*
|
|
|
|
|
Afficher les infos d'un candidat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Afficher la liste des candidats par departement trié par ordre alphabetique
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int rechercheCandidat(Etudiant *tetud[], int nbCandidats, int numRecherche, bool *trouve)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < nbCandidats; i++)
|
|
|
|
|
{
|
|
|
|
|
if (numRecherche == tetud[i]->num)
|
|
|
|
|
{
|
|
|
|
|
*trouve = true;
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*trouve = false;
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
void afficherEtudiant(Etudiant mEtudiant)
|
|
|
|
|
{
|
|
|
|
|
// TODO : Changer l'affichage
|
|
|
|
|
int i;
|
|
|
|
|
printf("%d\n%s\n%s\n%.2f\t%.2f\t%.2f\t%.2f\n%d\n", mEtudiant.num, mEtudiant.nom, mEtudiant.prenom, mEtudiant.tabMatiere[0], mEtudiant.tabMatiere[1], mEtudiant.tabMatiere[2], mEtudiant.tabMatiere[3], mEtudiant.nbChoix);
|
|
|
|
|
afficherChoix(mEtudiant.lChoix);
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void afficherCandidat(Etudiant *tetud[], int nbCandidats)
|
|
|
|
|
{
|
|
|
|
|
int num, index;
|
|
|
|
|
bool trouve;
|
|
|
|
|
printf("Veuillez entrer le numéro de l'étudiant recherché :\n> ");
|
|
|
|
|
scanf("%d", &num);
|
|
|
|
|
index = rechercheCandidat(tetud, nbCandidats, num, &trouve);
|
|
|
|
|
if (trouve == false)
|
|
|
|
|
{
|
|
|
|
|
printf("Le numéro de l'étudiant recherché n'existe pas.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
afficherEtudiant(*tetud[index]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void afficherCandidats(Etudiant *tetud[], int nbCandidats)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < nbCandidats; i++)
|
|
|
|
|
{
|
|
|
|
|
afficherEtudiant(*tetud[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int chargerCandidats(Etudiant *tetud[])
|
|
|
|
|
{
|
|
|
|
|
FILE *file;
|
|
|
|
@ -35,7 +72,7 @@ int chargerCandidats(Etudiant *tetud[])
|
|
|
|
|
printf("Erreur malloc");
|
|
|
|
|
exit(2);
|
|
|
|
|
}
|
|
|
|
|
fscanf(file, "%d%s%s", &tetud[i]->num, tetud[i]->nom, tetud[i]->prenom);
|
|
|
|
|
fscanf(file, "%d%s%s", &tetud[i]->num, tetud[i]->nom, tetud[i]->prenom); // TODO : Faire un fgets pour le prénom
|
|
|
|
|
for (int note = 0; note < 4; note++)
|
|
|
|
|
{
|
|
|
|
|
fscanf(file, "%f", &tetud[i]->tabMatiere[note]);
|
|
|
|
|