From 368eeb1b9273aef89e0f00cb19eb43ad254ce560 Mon Sep 17 00:00:00 2001 From: Lola CHALMIN Date: Tue, 13 Dec 2022 16:26:14 +0100 Subject: [PATCH] lire & aff --- commun.c | 16 ++++++++++------ testcommun.c | 8 ++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/commun.c b/commun.c index 90c41f0..ea11d35 100644 --- a/commun.c +++ b/commun.c @@ -37,15 +37,12 @@ Choix lirechx (void){ Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier { Candidat c; - int nEtu,nbchx; - float moymat, moyfr, moyen, moyspe; - char nom[20], prenom[20]; printf("Numéro de candidat :\n"); scanf("%d", &c.nEtu); printf("Nom du candidat :\n"); - fgets(); + fgets(c.nom, 20, stdin); printf("Prénom du candidat :\n"); - fgets(); + fgets(c.prenom, 20, stdin); printf("Moyenne de maths :\n"); scanf("%f", &c.moymat); printf("Moyenne de français :\n"); @@ -57,6 +54,13 @@ Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier printf("Nombre de choix :\n"); scanf("%d", &c.nbchx); scanf("%d", nbchx); - kdjfbnjn + return c; } +void AffC(Candidat c) +{ + printf("%d\n", c.nEtu); + printf("%s \n %s\n", c.nom, c.prenom); + printf("%.2f\t%.2f\t%.2f\t%.2f\n", c.moymat,c.moyfr, c.moyen, c.moyspe); + printf("%d\n", c.nbchx); +} \ No newline at end of file diff --git a/testcommun.c b/testcommun.c index c617419..3dfde61 100644 --- a/testcommun.c +++ b/testcommun.c @@ -2,3 +2,11 @@ #include #include #include "commun.h" + + +int main(void) +{ + Candidat c; + c = lireCandidat(); + return 0; +} \ No newline at end of file