From ac9945b6b7e2922daa088296badf0a84a6486c04 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 16:55:58 +0100 Subject: [PATCH] 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