Ajustements.

master
Yann CHAMPEAU 3 years ago
parent 5d0a5c2dff
commit 2e5c8b9203

@ -18,11 +18,19 @@ candidat** LoadCandid(int* CandidOpen, int* nbcandid)
//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
fread(nbcandid,sizeof(int),1,file); fread(nbcandid,sizeof(int),1,file);
candidat** Tabcandidat=(candidat**) malloc (sizeof(candidat*)*(*nbcandid)); candidat** Tabcandidat=(candidat**) malloc (sizeof(candidat*)*(*nbcandid));
if(Tabcandidat==NULL){
perror("malloc");
exit(errno);
}
//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`
Tabcandidat[i]=(candidat*)malloc(sizeof(candidat)); Tabcandidat[i]=(candidat*)malloc(sizeof(candidat));
if(Tabcandidat[i]==NULL){
perror("malloc");
exit(errno);
}
fread(&Tabcandidat[i]->numcandid,sizeof(int),1,file); fread(&Tabcandidat[i]->numcandid,sizeof(int),1,file);
fread(Tabcandidat[i]->surname,sizeof(char)*31,1,file); fread(Tabcandidat[i]->surname,sizeof(char)*31,1,file);
fread(Tabcandidat[i]->name,sizeof(char)*31,1,file); fread(Tabcandidat[i]->name,sizeof(char)*31,1,file);
@ -77,29 +85,29 @@ void RechercheCandidat(int ID, int nbcandidat,candidat *tcandidat[])
Note d'anglais : %f\n\ Note d'anglais : %f\n\
Note de spécialité : %f\n\ Note de spécialité : %f\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],tcandidat[i]->nbchoix);
for(int y=0;y<tcandidat[i].nbchoix;++y) for(int y=0;y<tcandidat[i]->nbchoix;++y)
{ {
printf("Ville : %s\n\ printf("Ville : %s\n\
Departement : %s\n\ Departement : %s\n\
Décision département : ",tcandidat[i].TabVoeu[y]->ville,tcandidat[i].TabVoeu[y]->dep); Décision département : ",tcandidat[i]->TabVoeu[y]->ville,tcandidat[i]->TabVoeu[y]->dep);
if(tcandidat[i].TabVoeu[y]->ddep==0) printf("Dossier non traité\n"); if(tcandidat[i]->TabVoeu[y]->ddep==0) printf("Dossier non traité\n");
else else
{ {
if(tcandidat[i].TabVoeu[y]->ddep==1) printf("Admis\n"); if(tcandidat[i]->TabVoeu[y]->ddep==1) printf("Admis\n");
else else
{ {
if (tcandidat[i].TabVoeu[y]->ddep==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(tcandidat[i].TabVoeu[y]->vcand==0) printf("Décision non rendu\n"); if(tcandidat[i]->TabVoeu[y]->vcand==0) printf("Décision non rendu\n");
else else
{ {
if(tcandidat[i].TabVoeu[y]->vcand==1) printf("Accepté\n"); if(tcandidat[i]->TabVoeu[y]->vcand==1) printf("Accepté\n");
else printf("Refusé"); else printf("Refusé");
} }
} }
@ -122,29 +130,29 @@ void ListeCandidat(int nbcandidat,candidat *tcandidat[])
Note d'anglais : %f\n\ Note d'anglais : %f\n\
Note de spécialité : %f\n\ Note de spécialité : %f\n\
Nombre de voeu : %d\n\ Nombre de voeu : %d\n\
Voeu :\n",i,tcandidat[i].numcandid,tcandidat[i].surname,tcandidat[i].name,\ Voeu :\n",i,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],tcandidat[i]->nbchoix);
for(int y=0;y<tcandidat[i].nbchoix;++y) for(int y=0;y<tcandidat[i]->nbchoix;++y)
{ {
printf("Ville : %s\n\ printf("Ville : %s\n\
Departement : %s\n\ Departement : %s\n\
Décision département : ",tcandidat[i].TabVoeu[y]->ville,tcandidat[i].TabVoeu[y]->dep); Décision département : ",tcandidat[i]->TabVoeu[y]->ville,tcandidat[i]->TabVoeu[y]->dep);
if(tcandidat[i].TabVoeu[y]->ddep==0) printf("Dossier non traité\n"); if(tcandidat[i]->TabVoeu[y]->ddep==0) printf("Dossier non traité\n");
else else
{ {
if(tcandidat[i].TabVoeu[y]->ddep==1) printf("Admis\n"); if(tcandidat[i]->TabVoeu[y]->ddep==1) printf("Admis\n");
else else
{ {
if (tcandidat[i].TabVoeu[y]->ddep==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(tcandidat[i].TabVoeu[y]->vcand==0) printf("Décision non rendu\n"); if(tcandidat[i]->TabVoeu[y]->vcand==0) printf("Décision non rendu\n");
else else
{ {
if(tcandidat[i].TabVoeu[y]->vcand==1) printf("Accepté\n"); if(tcandidat[i]->TabVoeu[y]->vcand==1) printf("Accepté\n");
else printf("Refusé"); else printf("Refusé");
} }
} }
@ -170,14 +178,14 @@ void Candidater(VilleIUT* tiut[],int *tlogi, candidat* tcandidat[], int numcandi
else else
{ {
int i; int i;
for (i=0;tcandidat[i].numcandid!=numcandid;++i); for (i=0;tcandidat[i]->numcandid!=numcandid;++i);
voeu* voeu_ajout = (voeu*) malloc (sizeof(voeu)); voeu* voeu_ajout = (voeu*) malloc (sizeof(voeu));
strcpy(voeu_ajout->ville,VilleRech); strcpy(voeu_ajout->ville,VilleRech);
strcpy(voeu_ajout->dep,DepRech); strcpy(voeu_ajout->dep,DepRech);
voeu_ajout->ddep=0; voeu_ajout->ddep=0;
voeu_ajout->vcand=0; voeu_ajout->vcand=0;
tcandidat[i].TabVoeu[tcandidat[i].nbchoix]=voeu_ajout; tcandidat[i]->TabVoeu[tcandidat[i]->nbchoix]=voeu_ajout;
tcandidat[i].nbchoix++; tcandidat[i]->nbchoix++;
} }
} }
@ -186,7 +194,11 @@ void Candidater(VilleIUT* tiut[],int *tlogi, candidat* tcandidat[], int numcandi
void CreateCandidat(candidat** tcandid,int* nbcandidat) void CreateCandidat(candidat** tcandid,int* nbcandidat)
{ {
candidat* Candidat_Ajout candidat* Candidat_Ajout=(candidat*)malloc(sizeof(candidat));
if(Candidat_Ajout==NULL){
perror("malloc");
exit(errno);
}
printf("Merci de rentrez votre nom :"); printf("Merci de rentrez votre nom :");
fgets(Candidat_Ajout->name, 31, stdin); fgets(Candidat_Ajout->name, 31, stdin);
printf("Merci de rentrez votre prénom :"); printf("Merci de rentrez votre prénom :");

Loading…
Cancel
Save