master
Jade VAN BRABANDT 3 years ago
parent ee171067a1
commit 11ab73f094

@ -22,9 +22,10 @@ void menuUser(VilleIUT* lvIUT[],int tlogi, int CandidOpen, candidat* tcandidat[]
printf("2 : Afficher tout les départements de chaques IUT\n");
printf("3 : Afficher le nombre de place en première année d'un IUT précis avec un département précis\n");
printf("4 : Rechercher les IUTs possèdant un département précis.\n");
printf("5 : S'enregistrer en tant que candidat.")
if(CandidOpen)
{
printf("5 : Candidater\n");
printf("6 : Candidater\n");
}
printf("9 : Revenir à l'écran de sélection du profil.\n\n");
printf("#--------------------------------------------------------------------#\n\n");
@ -52,13 +53,17 @@ void menuUser(VilleIUT* lvIUT[],int tlogi, int CandidOpen, candidat* tcandidat[]
reset();
break;
case 5:
CreateCandidat(tcandid,nbcandidat);
reset();
break;
case 6:
if(CandidOpen)
{
//candidater(......);
}
reset();
break;
case 6:
case 8:
//fonctionp4?????????();
reset();
break;

@ -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);
}

@ -260,6 +260,7 @@ int* fusion(tabG,tailleG,tabNoteG,tabD,tailleD,tabNoteD,retNote){
int* tri_fusion_rec(int tabIDCandidatAttente[], int tabNote[], int taille){
if(taille==1) return tabIDCandidatAttente;
int tabNoteG[taille/2], tabNoteD[taille-taille/2], retNote[taille];
tabcpy(tabNote,tabNoteG,taille/2);
tabcpy(tabNote+taille/2,tabNoteD,taille);

Loading…
Cancel
Save