master
Jade VAN BRABANDT 3 years ago
parent ad820cf62e
commit 2ee61e1263

BIN
SAE

Binary file not shown.

@ -75,11 +75,11 @@ void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi)
int boolF=0, i; int boolF=0, i;
printf("Entrez le nom de la ville contenant le département recherché :\n"); printf("Entrez le nom de la ville contenant le département recherché :\n");
scanf("%s",sVille); scanf("%s",sVille);
printf("Département y étant disponible :\n");
for (i=0;i<tlogi;++i) for (i=0;i<tlogi;++i)
{ {
if (lvIUT[i]->Ville==sVille) if (strcmp(lvIUT[i]->Ville,sVille))
{ {
printf("Département y étant disponible :\n");
MaillonDep* MaillonAct=lvIUT[i]->ldept; MaillonDep* MaillonAct=lvIUT[i]->ldept;
while (MaillonAct!=NULL) printf("%s",MaillonAct->departement); while (MaillonAct!=NULL) printf("%s",MaillonAct->departement);
boolF=1; boolF=1;
@ -98,7 +98,7 @@ void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi)
while (MaillonAct!=NULL) while (MaillonAct!=NULL)
{ {
if(MaillonAct->departement==sDep) if(strcmp(MaillonAct->departement,sDep))
{ {
printf("Nombre de place : %d\n",MaillonAct->nbp); printf("Nombre de place : %d\n",MaillonAct->nbp);
return; return;

@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include "saeP2.h" #include "saeP2.h"
#include <string.h>
candidat* LoadCandid(void) candidat* LoadCandid(void)
{ {
@ -15,93 +16,72 @@ candidat* LoadCandid(void)
//Lire la première ligne pr savoir combien d'étudiant je vais lire //Lire la première ligne pr savoir combien d'étudiant je vais lire
int nbcandid; int nbcandid;
fread(&nbcandid,sizeof(int),1,file); 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 : //Tant que j'ai des étudiants à lire :
for(int i=0;nbcandid>i;++i) for(int i=0;nbcandid>i;++i)
{ {
//Son numéro, Son nom, Son prenom, liste de note` //Son numéro, Son nom, Son prenom, liste de note`
candidat Candidat_ajout; candidat Candidat_ajout;
int numcandid; fread(&Candidat_ajout.numcandid,sizeof(int),1,file);
char surname[31]; fread(Candidat_ajout.surname,sizeof(char)*31,1,file);
char name[31]; fread(Candidat_ajout.name,sizeof(char)*31,1,file);
float note[4]; fread(Candidat_ajout.note,sizeof(float)*4,1,file);
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);
//Son nb de choix //Son nb de choix
int nbchoix; fread(&Candidat_ajout.nbchoix,sizeof(int),1,file);
fread(&nbchoix,sizeof(int),1,file);
//Tant que j'ai pas fait tout ces choix : //Tant que j'ai pas fait tout ces choix :
voeu* ListeVoeu_ajout=NULL; for(int y=0;y<Candidat_ajout.nbchoix;++y)
for(int y=0;y<nbchoix;++y)
{ {
//Je lis La ville, le département, la décision du dep, la validation du candidat //Je lis La ville, le département, la décision du dep, la validation du candidat
char ville[31]; voeu* voeu_ajout=(voeu*)malloc(sizeof(voeu));
char dep[31]; fread(voeu_ajout->ville,sizeof(char)*31,1,file);
int ddep; fread(voeu_ajout->dep,sizeof(char)*31,1,file);
int vcand; fread(&voeu_ajout->ddep,sizeof(int),1,file);
fread(ville,sizeof(char)*31,1,file); fread(&voeu_ajout->vcand,sizeof(int),1,file);
fread(dep,sizeof(char)*31,1,file); Candidat_ajout.TabVoeu[i]=voeu_ajout;
fread(&ddep,sizeof(int),1,file);
fread(&vcand,sizeof(int),1,file);
voeu voeu_ajout;
voeu_ajout.ville=ville;
voeu_ajout.dep=dep;
voeu_ajout.ddep=ddep;
voeu_ajout.vcand=vcand;
voeu ListeVoeu_ajout[100];
ListeVoeu_ajout[i]=voeu_ajout;
} }
Candidat_ajout.numcandid=numcandid; Tabcandidat[i]=Candidat_ajout;
Candidat_ajout.surname=surname;
Candidat_ajout.name=name;
Candidat_ajout.note=note;
Candidat_ajout.ListeVoeu=ListeVoeu_ajout;
Listecandidat[i]=Candidat_ajout;
} }
//Je sors en disant que le load est sucessful //Je sors en disant que le load est sucessful
printf("Chargement réussie."); printf("Chargement réussie.");
return Listecandidat; return Tabcandidat;
} }
/*
void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcand) void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcandidat)
{ {
for(int i=0;i<nbcandidat;++i) for(int i=0;i<nbcandidat;++i)
{ {
if(i==nbcandidat) if(i==nbcandidat)
{ {
printf("Candidat Trouvé :\n printf("Candidat Trouvé :\n\
Numéro : %d\n Numéro : %d\n\
Nom : %s\n Nom : %s\n\
Prenom : %s\n Prenom : %s\n\
Note de mathématique : %f\n Note de mathématique : %f\n\
Note de français : %f\n Note de français : %f\n\
Note d'anglais : %f\n Note d'anglais : %f\n\
Note de spécialité : %f\n Note de spécialité : %f\n\
Nombre de candidature : %d\n Nombre de voeu : %d\n\
Nombre de voeu : %d\n Voeu :\n",tcandidat[i].numcandid,tcandidat[i].surname,tcandidat[i].name,\
Voeu :\n",tcandidat[i].numcandid,tcandidat[i].surname,tcandidat[i].name, tcandidat[i].note[0],tcandidat[i].note[1],tcandidat[i].note[2],\
tcandidat[i].note[0],tcandidat[i].note[1],tcandidat[i].note[2], tcandidat[i].note[3],tcandidat[i].nbchoix);
tcandidat[i].note[3]); for(int y=0;y<tcandidat[i].nbchoix;++y)
for(int y=0;y<tcand[i].nbvoeu;++y)
{ {
printf("Ville : %s\n printf("Ville : %s\n\
Departement : %s\n Departement : %s\n\
Décision département : ",tcandid[i].ListeVoeu[y].ville,tcandid[i].ListeVoeu[y].dep); Décision département : ",tcandidat[i].TabVoeu[y]->ville,tcandidat[i].TabVoeu[y]->dep);
if(==0) printf("Dossier non traité\n"); if(tcandidat[i].TabVoeu[y]->ddep==0) printf("Dossier non traité\n");
else { else {
if(==1) printf("Admis\n"); if(tcandidat[i].TabVoeu[y]->ddep==1) printf("Admis\n");
else { else {
if (==2) printf("Liste d'attente\n"); if (tcandidat[i].TabVoeu[y]->ddep==2) printf("Liste d'attente\n");
else printf("Refusé\n"); else printf("Refusé\n");
} }
} }
printf("Décision du candidat : ") printf("Décision du candidat : ");
if(==0) printf("Décision non rendu\n"); if(tcandidat[i].TabVoeu[y]->vcand==0) printf("Décision non rendu\n");
else { else {
if(==1) printf("Accepté\n"); if(tcandidat[i].TabVoeu[y]->vcand==1) printf("Accepté\n");
else prinf("Refusé"); else printf("Refusé");
} }
} }
return; return;
@ -110,5 +90,6 @@ void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcand)
printf("Candidat non trouvé"); printf("Candidat non trouvé");
return; return;
} }
//void gestionPhaseCandidatures(); A FAIRE.*/ //void gestionPhaseCandidatures(); A FAIRE.*/

@ -12,10 +12,11 @@ typedef struct
int numcandid; int numcandid;
char surname[31]; char surname[31];
char name[31]; char name[31];
int note[4]; float note[4];
voeu ListeVoeu[100]; int nbchoix;
voeu* TabVoeu[20];
}candidat; }candidat;
candidat* LoadCandid(void); candidat* LoadCandid(void);
void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat* tcandidat);
//void gestionPhaseCandidatures(); A FAIRE. //void gestionPhaseCandidatures(); A FAIRE.

Loading…
Cancel
Save