MODIF changement complet test v1

master
Matheo THIERRY 2 years ago
parent 01acef0773
commit 7a5e03699c

@ -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("<! pb ouverture fichier in chargeretudiant !>\n");return-1;}
fscanf(fe, "%d", &nbetu);
a.carte = ensemblevide();
for(i=0; i<nbetu; i++){
if(i==tmax){printf("<! erreur fichier in chargeetudiant !>");fclose(fe);return-1;}
printf("bonjour");
tetu[i] = (listetuinfo*)malloc(sizeof(listetuinfo));
if(tetu[i]==NULL){printf("<! pb malloc in chargeretudiant !>\n");fclose(fe);return-1;}
a = lireEtu(fe);
a.carte = lireCarte(fe, a.nbchoix);
*tetu[i] = a;
i++;
}
fclose(fe);
return nbetu;

@ -41,7 +41,7 @@ typedef struct{
char prenometu[21];
int notes[4];
int nbchoix;
Listchoixdept* lchoixdept;
Listchoixdept* carte;
}listetuinfo;
// Partie 3

Loading…
Cancel
Save