diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index f404693..8afffcb 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -64,7 +64,11 @@ void DepEachIUT(VilleIUT* lvIUT[], int tlogi) { printf("\n - %s :",lvIUT[i]->Ville); MaillonDep* MaillonAct=lvIUT[i]->ldept; - while (MaillonAct!=NULL) printf("\t-%s\n",MaillonAct->departement); + while (MaillonAct!=NULL) + { + printf("\t-%s\n",MaillonAct->departement); + MaillonAct=MaillonAct->suivant; + } } } @@ -75,13 +79,16 @@ void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi) int boolF=0, i; printf("Entrez le nom de la ville contenant le département recherché :\n"); scanf("%s",sVille); - printf("Département y étant disponible :\n"); + printf("%d",tlogi); for (i=0;iVille==sVille) + if (!strcmp(lvIUT[i]->Ville,sVille)) { + printf("Département y étant disponible :\n"); MaillonDep* MaillonAct=lvIUT[i]->ldept; + printf("Test"); while (MaillonAct!=NULL) printf("%s",MaillonAct->departement); + printf("Test"); boolF=1; MaillonAct=MaillonAct->suivant; break; @@ -98,7 +105,7 @@ void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi) while (MaillonAct!=NULL) { - if(MaillonAct->departement==sDep) + if(strcmp(MaillonAct->departement,sDep)) { printf("Nombre de place : %d\n",MaillonAct->nbp); return; diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index e116ef9..1289f5a 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -2,8 +2,9 @@ #include #include #include "saeP2.h" +#include -/*candidat* LoadCandid(void) +candidat* LoadCandid(void) { //J'ouvre le fichier FILE* file; @@ -15,93 +16,72 @@ //Lire la première ligne pr savoir combien d'étudiant je vais lire int nbcandid; fread(&nbcandid,sizeof(int),1,file); - candidat* Listecandidat=(candidat*) malloc (sizeof(candidat)*nbcandid); + candidat* Tabcandidat=(candidat*) malloc (sizeof(candidat)*nbcandid); //Tant que j'ai des étudiants à lire : for(int i=0;nbcandid>i;++i) { //Son numéro, Son nom, Son prenom, liste de note` candidat Candidat_ajout; - int numcandid; - char surname[31]; - char name[31]; - float note[4]; - fread(&numcandid,sizeof(int),1,file); - fread(surname,sizeof(char)*31,1,file); - fread(name,sizeof(char)*31,1,file); - fread(note,sizeof(int)*4,1,file); + fread(&Candidat_ajout.numcandid,sizeof(int),1,file); + fread(Candidat_ajout.surname,sizeof(char)*31,1,file); + fread(Candidat_ajout.name,sizeof(char)*31,1,file); + fread(Candidat_ajout.note,sizeof(float)*4,1,file); //Son nb de choix - int nbchoix; - fread(&nbchoix,sizeof(int),1,file); + fread(&Candidat_ajout.nbchoix,sizeof(int),1,file); //Tant que j'ai pas fait tout ces choix : - voeu* ListeVoeu_ajout=NULL; - for(int y=0;yville,sizeof(char)*31,1,file); + fread(voeu_ajout->dep,sizeof(char)*31,1,file); + fread(&voeu_ajout->ddep,sizeof(int),1,file); + fread(&voeu_ajout->vcand,sizeof(int),1,file); + Candidat_ajout.TabVoeu[i]=voeu_ajout; } - Candidat_ajout.numcandid=numcandid; - Candidat_ajout.surname=surname; - Candidat_ajout.name=name; - Candidat_ajout.note=note; - Candidat_ajout.ListeVoeu=ListeVoeu_ajout; - Listecandidat[i]=Candidat_ajout; + Tabcandidat[i]=Candidat_ajout; } //Je sors en disant que le load est sucessful printf("Chargement réussie."); - return Listecandidat; -}*/ -/* -void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcand) + return Tabcandidat; +} + +void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcandidat) { for(int i=0;iville,tcandidat[i].TabVoeu[y]->dep); + if(tcandidat[i].TabVoeu[y]->ddep==0) printf("Dossier non traité\n"); else { - if(==1) printf("Admis\n"); + if(tcandidat[i].TabVoeu[y]->ddep==1) printf("Admis\n"); else { - if (==2) printf("Liste d'attente\n"); + if (tcandidat[i].TabVoeu[y]->ddep==2) printf("Liste d'attente\n"); else printf("Refusé\n"); } } - printf("Décision du candidat : ") - if(==0) printf("Décision non rendu\n"); + printf("Décision du candidat : "); + if(tcandidat[i].TabVoeu[y]->vcand==0) printf("Décision non rendu\n"); else { - if(==1) printf("Accepté\n"); - else prinf("Refusé"); + if(tcandidat[i].TabVoeu[y]->vcand==1) printf("Accepté\n"); + else printf("Refusé"); } } return; @@ -110,5 +90,6 @@ void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcand) printf("Candidat non trouvé"); return; } -//void gestionPhaseCandidatures(); A FAIRE.*/ + +//void gestionPhaseCandidatures(); A FAIRE. diff --git a/src/partie2/saeP2.h b/src/partie2/saeP2.h index bfd7647..4d1ac16 100644 --- a/src/partie2/saeP2.h +++ b/src/partie2/saeP2.h @@ -1,5 +1,5 @@ -/*typedef struct +typedef struct { char ville[31]; char dep[31]; @@ -12,10 +12,11 @@ typedef struct int numcandid; char surname[31]; char name[31]; - int note[4]; - voeu ListeVoeu[100]; + float note[4]; + int nbchoix; + voeu* TabVoeu[20]; }candidat; candidat* LoadCandid(void); - -//void gestionPhaseCandidatures(); A FAIRE.*/ +void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat* tcandidat); +//void gestionPhaseCandidatures(); A FAIRE.