work in progress

master
lolax 2 years ago
parent 6b43103422
commit 4c42b4837a

@ -17,7 +17,7 @@ Choix lirechx (void){//Fonction qui va lire les choix de la ville et du departem
printf("Saisir le choix du departement d'étude\n"); printf("Saisir le choix du departement d'étude\n");
fgets(chx.dptmt, 20, stdin); fgets(chx.dptmt, 20, stdin);
chx.dptmt[strlen(chx.dptmt)-1]= '\0'; chx.dptmt[strlen(chx.dptmt)-1]= '\0';
chx.dec = 0; chx.dec = 0;
chx.valid = 0; chx.valid = 0;
return chx; return chx;
@ -55,7 +55,7 @@ Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier
/* /*
Choix * chargeChoix(Choix *tchoix, TAILLE, nbchx){ Choix * chargeChoix(Choix *tchoix, TAILLE, nbchx){
} }
*/ */
@ -94,7 +94,7 @@ Candidat lireFich1Cand (FILE * fe){
void AffListeCandidat (Listecand l){ void AffListeCandidat (Listecand l){
if ( l == NULL) return; if ( l == NULL) return;
AffC(l->cand); AffC(l->cand);
AffListeCandidat(l->suivcand); AffListeCandidat(l->suivcand);
@ -103,13 +103,13 @@ void AffListeCandidat (Listecand l){
Listecand recherchenom (Listecand l, char *nom ){ Listecand recherchenom (Listecand l, char *nom ){
if ( l == NULL ){ return l;} if ( l == NULL ){ return l;}
if ( strcmp ( l->cand.nom, nom ) == 0) return l; if ( strcmp ( l->cand.nom, nom ) == 0) return l;
return recherchenom (l->suivcand, nom ); return recherchenom (l->suivcand, nom );
} }
Listecand recherchenum (Listecand l, int num){ Listecand recherchenum (Listecand l, int num){
if ( l == NULL ){ return l;} if ( l == NULL ){ return l;}
if ( l->cand.nEtu == num ) return l; if ( l->cand.nEtu == num ) return l;
return recherchenum (l->suivcand, num ); return recherchenum (l->suivcand, num );
} }
Listecand InsertT(Listecand list, Candidat c)//Insert en tête de la liste Listecand InsertT(Listecand list, Candidat c)//Insert en tête de la liste
@ -127,7 +127,7 @@ Listecand InsertT(Listecand list, Candidat c)//Insert en tête de la liste
c1->cand.nbchx = c.nbchx; c1->cand.nbchx = c.nbchx;
c1->suivcand = list; c1->suivcand = list;
return c1; return c1;
} }
@ -152,26 +152,25 @@ void Chargementlistecandidat( Mailloncand *cand, char *nameFile, int *n)// fonct
for ( int j = 0; j < = n; j++ ) for ( int j = 0; j < = n; j++ )
{ {
cand = (Mailloncand *)malloc(sizeof(Mailloncand)); cand = (Mailloncand *)malloc(sizeof(Mailloncand));
if (cand == NULL){printf("pb malloc");exit;} if (cand == NULL){printf("pb malloc");exit();}
fscanf(f, " %d %s %s %f %f %f %f %d ", &cand->cand.nEtu, cand->cand.nom, cand->cand.prenom, &cand->cand.moymat, &cand->cand.moyfr, &cand->cand.moyen, &cand->cand.moyspe, &cpt);
fscanf(f, " %d %s %s %.2f %.2f %.2f %.2f %d ", &cand->cand.nEtu, cand->cand.nom, cand->cand.prenom, &cand->cand.moymat, &cand->cand.moyfr, &cand->cand.moyen, &cand->cand.moyspe, &cpt);
for (cpt; cpt > 0; cpt--) for (cpt; cpt > 0; cpt--)
{ {
Maillonchx *chx; Maillonchx *chx;
chx = (Maillonchx*)malloc(sizeof(Maillonchx));//création du maillon chx = (Maillonchx*)malloc(sizeof(Maillonchx));//création du maillon
if (chx == NULL){printf("pb malloc"); exit;} if (chx == NULL){printf("pb malloc"); exit;}
lireM(f, chx);//lire le maillon avec la fonction plus haut lireM(f, chx);//lire le maillon avec la fonction plus haut
chx->ldept = Insert(tmp->lchx, chx);//insert le maillon à sa bonne place chx->ldept = Insert(tmp->lchx, chx);//insert le maillon à sa bonne place
} }
tV[i] = v;
i++; i++;
} }
return i; return i;
} }
@ -212,7 +211,7 @@ void test (void){
lcand = Insert(lcand , cand1); lcand = Insert(lcand , cand1);
AffListeCandidat(lcand); AffListeCandidat(lcand);
} }
//else if (menugest1 == 2) //else if (menugest1 == 2)
//FONCTION MISE A JOUR LISTE AVEC AFFICHAGE NOUVELLE LISTE //FONCTION MISE A JOUR LISTE AVEC AFFICHAGE NOUVELLE LISTE
@ -224,7 +223,7 @@ void test (void){
printf(""); printf("");
} }
} }
@ -267,4 +266,4 @@ void test (void){
//####################################### FILES ################################################# //####################################### FILES #################################################

Loading…
Cancel
Save