diff --git a/partie_3.c b/partie_3.c index d7157f7..da12341 100755 --- a/partie_3.c +++ b/partie_3.c @@ -6,52 +6,6 @@ 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.tabNotes[0], mEtudiant.tabNotes[1], mEtudiant.tabNotes[2], mEtudiant.tabNotes[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; @@ -111,6 +65,51 @@ void sauvegarderCandidats(Etudiant *tetud[], int nbCandidats) } } +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) +{ + printf("Numéro : %d\nNom : %s\nPrénom :%s\nNotes : %.2f\t%.2f\t%.2f\t%.2f\nNombre de choix : %d\n",mEtudiant.num, mEtudiant.nom, mEtudiant.prenom, mEtudiant.tabNotes[0], mEtudiant.tabNotes[1], mEtudiant.tabNotes[2], mEtudiant.tabNotes[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]); + } +} + void sauvegarderChoix(ListeChoix lChoix, FILE *file) { if (lChoix != NULL) @@ -304,6 +303,13 @@ int modifNbPlaces(int nbPlaces) return nbPlaces; } +int ajouterCandidat(Candidat *tiut[]) +{ + Candidat cand; + printf("Entrez votre nom et votre prénom :\n> "); + scanf("%s%s", cand.nom, cand.prenom) +} + // ? Comment definir la note sur 20 mise lors de l'etude du dossier ? // ? Ajouter une variable dans la structure Admission ? // ? Ou mettre la liste et la note dans un tableau ? diff --git a/resultats.txt b/resultats.txt index 66b5123..7a14784 100755 --- a/resultats.txt +++ b/resultats.txt @@ -20,16 +20,4 @@ Informatique Grenoble Informatique 0 -0 -Michelee -Jacquese -7.00 6.00 15.00 20.00 -2 -Clermont-Ferrand -Biologie -0 -0 -Grenoble -Nickeledeon -0 0 \ No newline at end of file diff --git a/structures.c b/structures.c index 055e81d..ea30cc1 100755 --- a/structures.c +++ b/structures.c @@ -116,5 +116,5 @@ int longueurChoix(ListeChoix lc) void afficherCandidatsChoix(Choix choix) { - printf("Ville : %s\nDépartement : %s\nAdmission : %d\nCandidat : %d\n", choix.ville, choix.departement, choix.decisionAdmission, choix.decisionCandidat); + printf("Ville : %s\nDépartement : %s\nAdmission : %d\nCandidat : %d\n", choix.ville, choix.departement, choix.decisionAdmission, choix.decisionCandidat); } \ No newline at end of file