diff --git a/sae1-02.c b/sae1-02.c index 5b47800..cb60a0a 100644 --- a/sae1-02.c +++ b/sae1-02.c @@ -72,7 +72,8 @@ charger -- recup : -nb choix -listcand -*/ + +-- pb avec ça Listchoixdept listchoixdeptvide(void){ return NULL; @@ -107,6 +108,25 @@ listetuinfo lireEtu(FILE *fe){ return b; } +*/ +ensemble ensemblevide(void){return NULL;} + +Listchoixdept lireCarte(FILE *fe, int nbchoix){ + if(nbchoix==0){return NULL;} + Maillonchoix* cc; + cc = (Maillonchoix*)malloc(sizeof(Maillonchoix*)); + fscanf(fe, "%s %s %d %d", cc->Ville, cc->dep, &cc->decision, &cc->validation); + cc.suivant = lireCarte(fe, nbchoix-1); + return cc; +} + +listetuinfo lireEtu(FILE *fe){ + listetuinfo b; + int i; + fscanf(fe, "%d %s %s %d %d %d %d %d", &b.numeroetu, b.nometu, b.prenometu, &b.notes[0], &b.notes[1], &b.notes[2], &b.notes[3], &b.nbchoix); + return b; +} + int chargeretudiant(char nomFich[], listetuinfo *tetu[], int tmax){ int i=0, nbetu; @@ -116,14 +136,15 @@ int chargeretudiant(char nomFich[], listetuinfo *tetu[], int tmax){ fe = fopen( nomFich, "r"); if(fe==NULL){printf("\n");return-1;} fscanf(fe, "%d", &nbetu); + a.carte = ensemblevide(); for(i=0; i");fclose(fe);return-1;} printf("bonjour"); tetu[i] = (listetuinfo*)malloc(sizeof(listetuinfo)); if(tetu[i]==NULL){printf("\n");fclose(fe);return-1;} a = lireEtu(fe); + a.carte = lireCarte(fe, a.nbchoix); *tetu[i] = a; - i++; } fclose(fe); return nbetu; diff --git a/sae1-02.h b/sae1-02.h index e2840c7..6881ccb 100644 --- a/sae1-02.h +++ b/sae1-02.h @@ -41,7 +41,7 @@ typedef struct{ char prenometu[21]; int notes[4]; int nbchoix; - Listchoixdept* lchoixdept; + Listchoixdept* carte; }listetuinfo; // Partie 3