une version qui marche pour sur

master
Lola CHALMIN 2 years ago
parent c97bbc3695
commit 4970551be4

@ -8,7 +8,7 @@
Choix lirechx (void){ Choix lirechx (void){
Choix chx; Choix chx;
printf("Saisir le choix de la ville\n"); printf("Saisir le choix de la ville \n");
fgets(chx.ville, 20, stdin); fgets(chx.ville, 20, stdin);
chx.ville[strlen(chx.ville)-1]= '\0'; chx.ville[strlen(chx.ville)-1]= '\0';
@ -42,7 +42,7 @@ Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier
{ {
Candidat c; Candidat c;
printf("Numéro de candidat :\n"); printf("Numéro de candidat :\n");
scanf("%d", &c.nEtu); scanf("%d%*c", &c.nEtu);
printf("Nom du candidat :\n"); printf("Nom du candidat :\n");
fgets(c.nom, 20, stdin); fgets(c.nom, 20, stdin);
printf("Prénom du candidat :\n"); printf("Prénom du candidat :\n");
@ -56,12 +56,10 @@ Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier
printf("Moyenne de spécialité au choix :\n"); printf("Moyenne de spécialité au choix :\n");
scanf("%f", &c.moyspe); scanf("%f", &c.moyspe);
printf("Nombre de choix :\n"); printf("Nombre de choix :\n");
scanf("%d", &c.nbchx); scanf("%d%*c", &c.nbchx);
scanf("%d", nbchx);
return c; return c;
} }
<<<<<<< HEAD
@ -88,15 +86,15 @@ Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier
/*
Choix * chargeChoix(Choix *tchoix, TAILLE, nbchx){ Choix * chargeChoix(Choix *tchoix, TAILLE, nbchx){
} }
*/
=======
void AffC(Candidat c) void AffC(Candidat c)
{ {
printf("%d\n", c.nEtu); printf("%d\n", c.nEtu);
@ -104,4 +102,3 @@ void AffC(Candidat c)
printf("%.2f\t%.2f\t%.2f\t%.2f\n", c.moymat,c.moyfr, c.moyen, c.moyspe); printf("%.2f\t%.2f\t%.2f\t%.2f\n", c.moymat,c.moyfr, c.moyen, c.moyspe);
printf("%d\n", c.nbchx); printf("%d\n", c.nbchx);
} }
>>>>>>> refs/remotes/origin/master

@ -36,6 +36,7 @@ typedef struct {
Candidat lireCandidat(void); Candidat lireCandidat(void);
Choix lirechx (void); Choix lirechx (void);
void AffC(Candidat c);

BIN
test

Binary file not shown.

@ -8,5 +8,8 @@ int main(void)
{ {
Candidat c; Candidat c;
c = lireCandidat(); c = lireCandidat();
AffC(c);
Choix chx;
chx = lirechx();
return 0; return 0;
} }
Loading…
Cancel
Save