|
|
|
@ -5,7 +5,7 @@
|
|
|
|
|
#include "../partie1/saeP1.h"
|
|
|
|
|
#include "../annexe/saeAnnexe.h"
|
|
|
|
|
|
|
|
|
|
candidat* LoadCandid(int* CandidOpen, int* nbcandid)
|
|
|
|
|
candidat** LoadCandid(int* CandidOpen, int* nbcandid)
|
|
|
|
|
{
|
|
|
|
|
//J'ouvre le fichier
|
|
|
|
|
FILE* file;
|
|
|
|
@ -17,20 +17,20 @@ candidat* LoadCandid(int* CandidOpen, int* nbcandid)
|
|
|
|
|
fread(CandidOpen,sizeof(int),1,file);
|
|
|
|
|
//Lire la première ligne pr savoir combien d'étudiant je vais lire
|
|
|
|
|
fread(nbcandid,sizeof(int),1,file);
|
|
|
|
|
candidat* Tabcandidat=(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;
|
|
|
|
|
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);
|
|
|
|
|
candidat* Candidat_ajout= (candidat*) malloc (sizeof(candidat));
|
|
|
|
|
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
|
|
|
|
|
fread(&Candidat_ajout.nbchoix,sizeof(int),1,file);
|
|
|
|
|
fread(&Candidat_ajout->nbchoix,sizeof(int),1,file);
|
|
|
|
|
//Tant que j'ai pas fait tout ces choix :
|
|
|
|
|
for(int y=0;y<Candidat_ajout.nbchoix;++y)
|
|
|
|
|
for(int y=0;y<Candidat_ajout->nbchoix;++y)
|
|
|
|
|
{
|
|
|
|
|
//Je lis La ville, le département, la décision du dep, la validation du candidat
|
|
|
|
|
voeu* voeu_ajout=(voeu*)malloc(sizeof(voeu));
|
|
|
|
@ -182,4 +182,32 @@ void Candidater(VilleIUT* tiut[],int *tlogi, candidat* tcandidat, int numcandid)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CreateCandidat(candidat** tcandid,int* nbcandidat)
|
|
|
|
|
{
|
|
|
|
|
candidat* Candidat_Ajout
|
|
|
|
|
printf("Merci de rentrez votre nom :");
|
|
|
|
|
fgets(Candidat_Ajout->name, 31, stdin);
|
|
|
|
|
printf("Merci de rentrez votre prénom :");
|
|
|
|
|
fgets(Candidat_Ajout->surname, 31, stdin);
|
|
|
|
|
printf("Merci de rentrez votre note en Mathématique :");
|
|
|
|
|
scanf("%d",Candidat_Ajout->note[0]);
|
|
|
|
|
printf("Merci de rentrez votre note en Français :");
|
|
|
|
|
scanf("%d",Candidat_Ajout->note[1]);
|
|
|
|
|
printf("Merci de rentrez votre note en Anglais :");
|
|
|
|
|
scanf("%d",Candidat_Ajout->note[2]);
|
|
|
|
|
printf("Merci de rentrez votre note en Spécialité :");
|
|
|
|
|
scanf("%d",Candidat_Ajout->note[3]);
|
|
|
|
|
(candidat**) realloc (tcandid,sizeof(candidat)*((*nbcandidat)++));
|
|
|
|
|
if (tcandid==NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr,"Tableau candidat corrompue\n");
|
|
|
|
|
perror("Erreur :");
|
|
|
|
|
exit(errno);
|
|
|
|
|
}
|
|
|
|
|
tcandid[nbcandidat-1]=Candidat_Ajout;
|
|
|
|
|
printf("Ajout fini\nVotre numéro de candidat est : %d",\
|
|
|
|
|
Candidat_Ajout->numcandid);
|
|
|
|
|
}
|