maj de la partie 2

master
Khena BRUNEAU 2 years ago
parent 4928957e1e
commit f2c41d1c32

Binary file not shown.

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

@ -10,7 +10,7 @@ typedef struct
char nom[20]; char nom[20];
float lNote[4]; float lNote[4];
int nbChoix; int nbChoix;
struct Choix lChoix[nbChoix]; struct Choix *lChoix;
} Candidat; } Candidat;
typedef struct typedef struct
@ -23,14 +23,19 @@ typedef struct
typedef struct maillon typedef struct maillon
{ {
struct Candidat c; Candidat *c;
struct maillon *suiv; struct maillon *suiv;
int h;
} Maillon, *Liste; } Maillon, *Liste;
/*Implémentation liste*/
Liste listenouv(void);
void affichage(Liste l);
void global(void);
/*Reste*/
Liste inscription(Liste lCand, int nbInsc); Liste inscription(Liste lCand, int nbInsc);
Liste candidater(Liste lCand, Candidat c); Liste candidater(Liste lCand, Candidat c);
Liste modifier(Liste lCand, Candidat c); Liste modifier(Liste lCand, Candidat c);
Liste supprimer(Liste lCand, Candidat c); Liste supprimer(Liste lCand, Candidat c);
void sauvegarder(Liste l); void sauvegarder(Liste l);
void affichage(Liste l);
void global(void);

@ -4,10 +4,13 @@ void testInsc(void)
{ {
Liste l; Liste l;
int nb=0; int nb=0;
l=listenouv();
l=inscription(l, nb); l=inscription(l, nb);
affichage(l);
} }
int main(void) int main(void)
{ {
testInsc();
return 1; return 1;
} }
Loading…
Cancel
Save