|
|
@ -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.*/
|
|
|
|
|
|
|
|
|
|
|
|