diff --git a/part2.c b/part2.c index 3ec5a44..a41b4fb 100644 --- a/part2.c +++ b/part2.c @@ -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"); fgets(chx.dptmt, 20, stdin); chx.dptmt[strlen(chx.dptmt)-1]= '\0'; - + chx.dec = 0; chx.valid = 0; return chx; @@ -55,7 +55,7 @@ Candidat lireCandidat(void)//fonction qui lit un candidat sur le clavier /* Choix * chargeChoix(Choix *tchoix, TAILLE, nbchx){ - + } */ @@ -94,7 +94,7 @@ Candidat lireFich1Cand (FILE * fe){ void AffListeCandidat (Listecand l){ - + if ( l == NULL) return; AffC(l->cand); AffListeCandidat(l->suivcand); @@ -103,13 +103,13 @@ void AffListeCandidat (Listecand l){ Listecand recherchenom (Listecand l, char *nom ){ if ( l == NULL ){ 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){ if ( l == NULL ){ 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 @@ -127,7 +127,7 @@ Listecand InsertT(Listecand list, Candidat c)//Insert en tête de la liste c1->cand.nbchx = c.nbchx; c1->suivcand = list; return c1; - + } @@ -152,26 +152,25 @@ void Chargementlistecandidat( Mailloncand *cand, char *nameFile, int *n)// fonct for ( int j = 0; j < = n; j++ ) { - + 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--) - { + { Maillonchx *chx; chx = (Maillonchx*)malloc(sizeof(Maillonchx));//création du maillon if (chx == NULL){printf("pb malloc"); exit;} 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++; } return i; - - + + } @@ -212,7 +211,7 @@ void test (void){ lcand = Insert(lcand , cand1); AffListeCandidat(lcand); } - + //else if (menugest1 == 2) //FONCTION MISE A JOUR LISTE AVEC AFFICHAGE NOUVELLE LISTE @@ -224,7 +223,7 @@ void test (void){ printf(""); } - + } @@ -267,4 +266,4 @@ void test (void){ -//####################################### FILES ################################################# \ No newline at end of file +//####################################### FILES #################################################