From 73f9f3b4b48684e6efe3e9b90cab08641a75bb25 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 16:43:18 +0100 Subject: [PATCH 1/2] =?UTF-8?q?commentaires=20sur=20la=20fonction=20cr?= =?UTF-8?q?=C3=A9er=20candidat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/sae.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/sae.c b/source/sae.c index 00e22b6..0beb9a8 100644 --- a/source/sae.c +++ b/source/sae.c @@ -738,7 +738,14 @@ void afficherCandidats(Candidat **candidats, int nbCandidats) } } - +/** + * @brief Permet de créer un candidat + * + * @param tCand Tableau de pointeur sur une structure de candidat + * @param nbCandidats nombre de candidats créés + * + * @return Retourne le nombre de candidats + */ int creerCandidat(Candidat *tCand[], int nbCandidats) { int i=0; @@ -776,6 +783,8 @@ int creerCandidat(Candidat *tCand[], int nbCandidats) } + + /* ================================================ Partie 3 From ac9945b6b7e2922daa088296badf0a84a6486c04 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 16:55:58 +0100 Subject: [PATCH 2/2] modifierCandidat --- header/sae.h | 7 ++++++- source/candidat.c | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 source/candidat.c diff --git a/header/sae.h b/header/sae.h index efeafb7..cf1b334 100644 --- a/header/sae.h +++ b/header/sae.h @@ -175,4 +175,9 @@ VilleIut * initialiseIut(void); VilleIut * lireIut (FILE * fichier); VilleIut ** chargeIutDon(char nomFichier[], int * nbIut, int * nbMax); VilleIut ** initialiseTabIut(void); -void tailleSupTabIut(VilleIut ** tIut, int *nbMax); \ No newline at end of file +void tailleSupTabIut(VilleIut ** tIut, int *nbMax); + + +// candidat.c + +Candidat *modifierCandidat(Candidat *c); diff --git a/source/candidat.c b/source/candidat.c new file mode 100644 index 0000000..da84179 --- /dev/null +++ b/source/candidat.c @@ -0,0 +1,26 @@ +#include "../header/sae.h" + + +Candidat *modifierCandidat(Candidat *c) +{ + int choix; + printf("Que voulez vous modifier\n1-Le nom\n2-Le Prenom\n3-Les notes\n"); + scanf("%d", &choix); + switch (choix) + { + case 1: + printf("Nom actuel : %s\nVeuillez saisir le nouveau nom\n", c->nom); + fgets(c->nom, 50, stdin); + c->nom[strlen(c->nom) - 1] = '\0'; + break; + case 2: + printf("Prenom actuel : %s\nVeuillez saisir le nouveau prenom\n", c->prenom); + fgets(c->nom, 50, stdin); + c->nom[strlen(c->nom) - 1] = '\0'; + break; + case 3: + printf("Voici les notes actuels : %.2f %.2f %.2f %.2f\nVeuillez saisir les nouvelles notes(note1/note2/note3/note4", c->notes[0], c->notes[1], c->notes[2], c->notes[3]); + scanf("%f/%f/%f/%f", &c->notes[0], &c->notes[1], &c->notes[2], &c->notes[3]); + break; + } +} \ No newline at end of file