Maj de la partie 2

master
Khena BRUNEAU 2 years ago
parent c37ec4cc48
commit caeece4f46

Binary file not shown.

@ -10,7 +10,7 @@ bool vide(Liste l)
return l==NULL; return l==NULL;
} }
Liste inserer(Liste l, Candidat *can) Liste inserer(Liste l, Candidat can)
{ {
Maillon *m; Maillon *m;
m=(Maillon*)malloc(sizeof(Maillon)); m=(Maillon*)malloc(sizeof(Maillon));
@ -19,32 +19,38 @@ Liste inserer(Liste l, Candidat *can)
printf("Pb malloc\n"); printf("Pb malloc\n");
exit(1); exit(1);
} }
m->c=can; m->c=&can;
m->suiv=l; m->suiv=l;
m->h=m->h+1; m->h=m->h+1;
return m; return m;
} }
void affichage(Liste l) void affichageT(Liste l)
/*affiche la liste des candidats*/ /*affiche la liste de tous les candidats*/
{ {
printf("Numéro \t Prénom \t Nom \t Notes \t Nombre voeux \t Voeux\n"); printf("Numéro \tPrénom \tNom\n");
affichage1(*l->c);
}
void affichage1(Candidat c)
/*affiche les informations d'un candidat*/
{
printf("%d \t%s \t%s\n", c.numC, c.prenom, c.nom);
} }
Liste inscription(Liste lCand, int nbInsc) Liste inscription(Liste lCand, int nbInsc)
/* inscript un candidat en rentrant toutes ses informations*/ /* inscript un candidat en rentrant toutes ses informations*/
{ {
Candidat *c; Candidat c;
printf("Veuillez rentrer votre prénom : "); printf("Veuillez rentrer votre prénom : ");
scanf("%s", c->prenom); scanf("%s", c.prenom);
printf("%s\n", c.prenom);
printf("Veuillez rentrer votre nom : "); printf("Veuillez rentrer votre nom : ");
scanf("%*c%s", c->nom); scanf("%s", c.nom);
printf("Entrez les notes : "); printf("%s\n", c.nom);
scanf("%f %f %f %f", &c->lNote[0], &c->lNote[1], &c->lNote[2], &c->lNote[3]); c.nbChoix=0;
c->nbChoix=0; c.lChoix=NULL;
c->lChoix=NULL; c.numC=nbInsc + 1;
c->numC=nbInsc + 1;
lCand=inserer(lCand, c); lCand=inserer(lCand, c);
return lCand; return lCand;
} }

@ -3,6 +3,14 @@
#include<string.h> #include<string.h>
#include<stdbool.h> #include<stdbool.h>
typedef struct
{
char ville;
char dpt;
int chDpt;
int chCand;
} Choix;
typedef struct typedef struct
{ {
int numC; int numC;
@ -10,17 +18,9 @@ typedef struct
char nom[20]; char nom[20];
float lNote[4]; float lNote[4];
int nbChoix; int nbChoix;
struct Choix *lChoix; Choix *lChoix;
} Candidat; } Candidat;
typedef struct
{
char ville;
char dpt;
int chDpt;
int chCand;
} Choix;
typedef struct maillon typedef struct maillon
{ {
Candidat *c; Candidat *c;
@ -30,7 +30,8 @@ typedef struct maillon
/*Implémentation liste*/ /*Implémentation liste*/
Liste listenouv(void); Liste listenouv(void);
void affichage(Liste l); void affichageT(Liste l);
void affichage1(Candidat c);
void global(void); void global(void);
/*Reste*/ /*Reste*/

@ -6,7 +6,7 @@ void testInsc(void)
int nb=0; int nb=0;
l=listenouv(); l=listenouv();
l=inscription(l, nb); l=inscription(l, nb);
affichage(l); affichageT(l);
} }
int main(void) int main(void)

Loading…
Cancel
Save