Ajout de la fonction saveIUT() permettant de sauvegarder les IUTs enregistrés en mémoire.

master
Yann CHAMPEAU 3 years ago
commit 72c83e78dd

2
.gitignore vendored

@ -36,6 +36,7 @@
*.i*86
*.x86_64
*.hex
SAE
# Debug files
*.dSYM/
@ -61,6 +62,7 @@ dkms.conf
# Icon must end with two \r
Icon
# Thumbnails
._*

@ -0,0 +1 @@
src/DataBase/Etudiants.bin

@ -0,0 +1,5 @@
A
6
Yann

@ -1,9 +1,14 @@
PHONY : clean doc all
all : prog
.PHONY: clean doc all
all : prog EXE
prog :
make -C src all
EXE :
rm -f SAE
gcc -g -o SAE src/saeMain.o src/annexe/saeAnnexe.o src/partie1/saeP1.o src/partie2/saeP2.o src/partie3/saeP3.o src/partie4/saeP4.o
doc :
make -C src doc

@ -1,16 +1,13 @@
all : SAE
.PHONY : all doc clean lib
.PHONY : all doc clean
all : saeMain.o lib
lib : annexe/saeAnnexe.o partie1/saeP1.o partie2/saeP2.o partie3/saeP3.o partie4/saeP4.o
make -C annexe all
make -C partie1 all
make -C partie2 all
make -C partie3 all
make -C partie4 all
SAE : saeMain.o lib
gcc -o ../SAE saeMain.o annexe/saeAnnexe.o partie1/saeP1.o partie2/saeP2.o partie3/saeP3.o partie4/saeP4.o
lib :
make -C annexe
make -C partie1
make -C partie2
make -C partie3
make -C partie4
saeMain.o : saeMain.c
gcc -Wall -c saeMain.c

@ -1,3 +1,7 @@
CC = gcc
CCOPTS = -Wall
all : saeAnnexe.o
saeAnnexe.o : saeAnnexe.c saeAnnexe.h

@ -15,6 +15,7 @@ void menu(void){
printf("C : Consultation.\n");
printf("A : Administrateur.\n");
printf("S : Sauvegarder.\n\n");
printf("Q : Quitter.\n\n");
printf("#--------------------------------------------------------------------#\n\n");
printf("Choisissez votre session : ");
}
@ -59,6 +60,7 @@ int loadIUT(VilleIUT** tiut){
return tlogi;
}
<<<<<<< HEAD
void saveIUT(VilleIUT** tiut, int tlogi){
FILE* f=fopen("Etudiants.bin","rb");
if(f==NULL){
@ -85,12 +87,14 @@ void saveIUT(VilleIUT** tiut, int tlogi){
}
int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot){
=======
int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){
>>>>>>> d1df1ce5e50feb147850be94e120a32207905272
if(!lTab){
fprintf(stderr,"Erreur, Pas d'éléments dans le tableau !");
return -1;
}
for(int i=0; i<lTab;i++){
if(tab[i]->Ville==mot) return i;
if(!strcmp(tab[i]->Ville,mot)) return i;
}
return -1;
}

@ -33,7 +33,7 @@ int loadIUT(VilleIUT** tiut); //
//
void saveIUT(VilleIUT** tiut, int tlogi); //
//
int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot); //
int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]); //
//
//
//

@ -1,7 +1,7 @@
all : saeP1.o
saeP1.o : saeP1.c saeP1.h
gcc -Wall -c saeP1.c
gcc -Wall -Werror -Wextra -g -c saeP1.c
doc : saeP1.h
doxygen

@ -8,9 +8,11 @@
//Partie Consultant.
void MenuUser(VilleIUT* lvIUT[],int tlogi)
void menuUser(VilleIUT* lvIUT[],int tlogi)
{
int quit=0;
while(!quit)
{
int intUserEntry=0;
printf("#--------------------------------------------------------------------#\n");
printf("| |\n");
printf("| SAE S1.02 |\n");
@ -21,33 +23,60 @@ void MenuUser(VilleIUT* lvIUT[],int tlogi)
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");
/*if(CandidOpen)
{
printf("5 : Candidater");
}*/
printf("9 : Revenir à l'écran de sélection du profil.\n\n");
printf("#--------------------------------------------------------------------#\n\n");
while(intUserEntry!=9)
{
printf("Choisissez l'action que vous voulez exécuter : ");
if (!(scanf("%d",intUserEntry)))printf("Entrée innexacte. Veuillez réessayer");
if (intUserEntry==1) SearchCityWithIUT(lvIUT,tlogi);
if (intUserEntry==2) DepEachIUT(lvIUT,tlogi);
if (intUserEntry==3) SearchPlaceFromDepInIUT(lvIUT,tlogi);
if (intUserEntry==4) SearchIUTFromDep(lvIUT,tlogi);
if (intUserEntry==9) printf("Sortie en cours.\n");
else printf("Entrée innexacte. Veuillez réessayer");
int act;
scanf("%d",&act);
switch(act){
case 1:
SearchCityWithIUT(lvIUT,tlogi);
reset();
break;
case 2:
DepEachIUT(lvIUT,tlogi);
reset();
break;
case 3:
SearchPlaceFromDepInIUT(lvIUT,tlogi);
reset();
break;
case 4:
SearchIUTFromDep(lvIUT,tlogi);
reset();
break;
case 5:
//candidater(......);
reset();
break;
case 9:
quit=1;
reset();
}
}
}
void SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi)
{
for (int i=0;i<tlogi;++i) printf("%s",lvIUT[i]->Ville);
for (int i=0;i<tlogi;++i) printf("\n - %s",lvIUT[i]->Ville);
}
void DepEachIUT(VilleIUT* lvIUT[], int tlogi)
{
for (int i=0;i<tlogi;++i)
{
printf("%s :",lvIUT[i]->Ville);
printf("\n - %s :",lvIUT[i]->Ville);
MaillonDep* MaillonAct=lvIUT[i]->ldept;
while (MaillonAct!=NULL) printf("\t-%s\n",MaillonAct->departement);
while (MaillonAct!=NULL)
{
printf("\t-%s\n",MaillonAct->departement);
MaillonAct=MaillonAct->suivant;
}
}
}
@ -56,57 +85,63 @@ void SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi)
char sVille[31];
char sDep[31];
int boolF=0, i;
printf("Entrez le nom de la ville contenant le département recherché :\n");
printf("\nEntrez le nom de la ville contenant le département recherché :\n");
scanf("%s",sVille);
printf("Département y étant disponible :\n");
for (i=0;i<tlogi;++i)
{
if (lvIUT[i]->Ville==sVille)
if (!strcmp(lvIUT[i]->Ville,sVille))
{
printf("\nDépartement y étant disponible :\n");
MaillonDep* MaillonAct=lvIUT[i]->ldept;
while (MaillonAct!=NULL) printf("%s",MaillonAct->departement);
boolF=1;
while (MaillonAct!=NULL)
{
printf("\t-%s\n",MaillonAct->departement);
MaillonAct=MaillonAct->suivant;
}
boolF=1;
break;
}
}
if (!boolF)
{
printf("La ville n'est pas dans la liste.\nMerci de vérifier l'orthographe.\n");
printf("\nLa ville n'est pas dans la liste.\nMerci de vérifier l'orthographe.\n");
return;
}
printf("Entrez le nom du département dont vous souhaitez connaitre le nombre de place\n");
printf("\nEntrez le nom du département dont vous souhaitez connaitre le nombre de place\n");
scanf("%s",sDep);
MaillonDep* MaillonAct=lvIUT[i]->ldept;
while (MaillonAct!=NULL)
{
if(MaillonAct->departement==sDep)
if(!strcmp(MaillonAct->departement,sDep))
{
printf("Nombre de place : %d\n",MaillonAct->nbp);
printf("\nNombre de place : %d\n",MaillonAct->nbp);
return;
}
MaillonAct=MaillonAct->suivant;
}
printf("Le département n'est pas dans la liste.\nMerci de vérifier l'orthographe.\n");
printf("\nLe département n'est pas dans la liste.\nMerci de vérifier l'orthographe.\n");
}
void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi)
{
char sDep[31];
printf("Merci de renseignez le département dont vous cherchez les IUTs :\n");
printf("\nMerci de renseignez le département dont vous cherchez les IUTs :\n");
scanf("%s",sDep);
printf("\nVoici la liste des IUTs contenant le département mentionné :\n\n");
for (int i=0;i<tlogi;++i)
{
MaillonDep* MaillonAct=lvIUT[i]->ldept;
if(MaillonAct->departement==sDep) printf("%s",lvIUT[i]->Ville);
while(MaillonAct!=NULL){
if(!strcmp(MaillonAct->departement,sDep)) printf("\t-%s\n",lvIUT[i]->Ville);
MaillonAct=MaillonAct->suivant;
}
}
}
//Partie Administrateur.
void menuAdmin(VilleIUT* tiut[],int tlogi){
void menuAdmin(VilleIUT* tiut[],int *tlogi){
int quit=0;
while(!quit){
printf("#--------------------------------------------------------------------#\n");
@ -120,6 +155,7 @@ void menuAdmin(VilleIUT* tiut[],int tlogi){
printf("3 : Supprimer un département dun IUT.\n");
printf("4 : Lancer et arrêter la phase de candidature.\n");
printf("5 : Modifier le nom d'un responsable de département.\n");
printf("6 : Créer un IUT.\n");
printf("9 : Revenir à l'écran de sélection du profil.\n\n");
printf("#--------------------------------------------------------------------#\n\n");
printf("Choisissez l'action que vous voulez exécuter : ");
@ -127,15 +163,15 @@ void menuAdmin(VilleIUT* tiut[],int tlogi){
scanf("%d",&act);
switch(act){
case 1:
modifPlaces(tiut,tlogi);
modifPlaces(tiut,*tlogi);
reset();
break;
case 2:
creerDep(tiut,tlogi);
creerDep(tiut,*tlogi);
reset();
break;
case 3:
supprimerDep(tiut,tlogi);
supprimerDep(tiut,*tlogi);
reset();
break;
case 4:
@ -143,7 +179,11 @@ void menuAdmin(VilleIUT* tiut[],int tlogi){
reset();
break;
case 5:
modifNomResponsable(tiut,tlogi);
modifNomResponsable(tiut,*tlogi);
reset();
break;
case 6:
creerIUT(tiut,tlogi);
reset();
break;
case 9:
@ -156,18 +196,18 @@ void menuAdmin(VilleIUT* tiut[],int tlogi){
void modifPlaces(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<0){
fprintf(stderr,"\nVille non existante !\n");
return;
}
VilleIUT* v=tiut[noVille];
printf("\n\nEntrez le département à modifier :");
char dep[31];
scanf("%*c%s",&dep);
if(!existeDep(tiut->ldept,dep)){
scanf("%s",dep);
if(!existeDep(v->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n");
return;
}
@ -184,15 +224,25 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){
void creerDep(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<0){
fprintf(stderr,"\nVille non existante !\n");
return;
}
VilleIUT* v=tiut[noVille];
int ck=0;
if(v->ldept==NULL){
ck=1;
v->ldept=(MaillonDep*)malloc(sizeof(MaillonDep));
if(v->ldept==NULL){
perror("malloc");
exit(errno);
}
}
MaillonDep* m=v->ldept;
if(!ck){
while(m->suivant!=NULL) m=m->suivant;
m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep));
if(m->suivant==NULL){
@ -200,35 +250,33 @@ void creerDep(VilleIUT* tiut[],int tlogi){
exit(errno);
}
m=m->suivant;
}
printf("\n\nEntrez le nom du département à créer : ");
char dep[31];
scanf("%*c%s",&dep);
strcpy(m->departement,dep);
scanf("%*c%s",m->departement);
printf("\n\nEntrez le nombre de places disponibles dans le département : ");
scanf("%d",&m->nbp);
printf("\n\nEntrez le nom du responsable de département :");
char resp[51];
scanf("%*c%s",&resp);
strcpy(m->resp,resp);
printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",dep,ville);
printf("\n\nEntrez le nom du responsable de département : \n");
scanf("%*c");
fgets(m->resp, 51, stdin);
printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",m->departement,ville);
return;
}
void supprimerDep(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<0){
fprintf(stderr,"\nVille non existante !\n");
return;
}
VilleIUT* v=tiut[noVille];
printf("\n\nEntrez le département à supprimer:");
char dep[31];
scanf("%*c%s",&dep);
if(!existeDep(tiut->ldept,dep)){
scanf("%s",dep);
if(!existeDep(v->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n");
return;
}
@ -236,6 +284,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
if(m->departement==dep){
printf("\n\nVoulez-vous supprimer le département %s de la ville de %s ? (Y pour continuer)\n\n",m->departement,v->Ville);
char choix;
scanf("%*c%c",&choix);
if(choix!='Y') return;
v->ldept=m->suivant;
free(m);
@ -244,6 +293,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
while(m->suivant->departement!=dep) m=m->suivant;
printf("\n\nVoulez-vous supprimer le département %s de la ville de %s ? (Y pour continuer)\n\n",m->suivant->departement,v->Ville);
char choix;
scanf("%*c%c",&choix);
if(choix!='Y') return;
MaillonDep* temp;
temp=m->suivant;
@ -257,18 +307,18 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
void modifNomResponsable(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",&ville);
scanf("%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
int noVille=rechercheIUT(tiut,tlogi,ville);
if(noVille<0){
fprintf(stderr,"\nVille non existante !\n");
return;
}
VilleIUT* v=tiut[noVille];
printf("\n\nEntrez le département à modifier:");
char dep[31];
scanf("%*c%s",&dep);
if(!existeDep(tiut->ldept,dep)){
scanf("%s",dep);
if(!existeDep(v->ldept,dep)){
fprintf(stderr,"\nDépartement non existant !\n");
return;
}
@ -276,8 +326,31 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){
while(m->departement!=dep) m=m->suivant;
printf("\n\nLe responsable du département %s de l'IUT de la ville de %s est actuellement %s. Quel est le nom du nouveau responsable ?\n\n",m->departement,v->Ville,m->resp);
char nom[51];
scanf("%d",&nom);
scanf("%s",nom);
strcpy(m->resp,nom);
printf("\n\nLe nom du responsable du département %s de l'IUT de %s a bien été changé pour %s.\n",dep,ville,nom);
return;
}
void creerIUT(VilleIUT* tiut[],int* tlogi){
printf("\nEntrez le nom de la ville correspondant à l'IUT à ajouter (Q pour abandonner): ");
char ville[31];
scanf("%*c%s",ville);
if(ville[0]=='Q' && ville[1]=='\0') return;
int noVille=rechercheIUT(tiut,*tlogi,ville);
if(noVille>=0){
fprintf(stderr,"\nVille déjà existante !\n");
return;
}
VilleIUT* v=(VilleIUT*)malloc(sizeof(VilleIUT));
if(v==NULL){
perror("malloc");
exit(errno);
}
strcpy(v->Ville,ville);
v->ldept=NULL;
tiut[*tlogi]=v;
*tlogi=*tlogi+1;
printf("\n\nL'IUT de %s a bien été ajouté.\n",ville);
return;
}

@ -28,7 +28,7 @@ void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi);
//Admin
void menuAdmin(VilleIUT* tiut[],int tlogi);
void menuAdmin(VilleIUT* tiut[],int* tlogi);
void modifPlaces(VilleIUT* tiut[],int tlogi);
@ -37,3 +37,5 @@ void creerDep(VilleIUT* tiut[],int tlogi);
void supprimerDep(VilleIUT* tiut[],int tlogi);
void modifNomResponsable(VilleIUT* tiut[],int tlogi);
void creerIUT(VilleIUT* tiut[],int* tlogi);

@ -2,13 +2,15 @@
#include <stdlib.h>
#include <errno.h>
#include "saeP2.h"
#include <string.h>
#include "../annexe/saeAnnexe.h"
#include "../partie1/saeP1.h"
candidat* LoadCandid(void)
{
//J'ouvre le fichier
FILE* file;
if((file=fopen(candid.bin,"wb")==NULL)
if((file=fopen("candid.bin","rb"))==NULL)
{
perror("Erreur : ");
exit(1);
@ -16,98 +18,173 @@ candidat* LoadCandid(void)
//Lire la première ligne pr savoir combien d'étudiant je vais lire
int nbcandid;
fread(&nbcandid,sizeof(int),1,file);
candidat Listecandidat[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
int numcandid;
char surname[31];
char name[31];
float note[4];
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 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);
//Son nb de choix
int nbchoix;
fread(&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<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
char ville[31];
char dep[31];
int ddep;
int vcand;
fread(ville,sizeof(char)*31,1,file);
fread(dep,sizeof(char)*31,1,file);
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;
Candidat_ajout.surname=surname;
Candidat_ajout.name=name;
Candidat_ajout.note=note;
Candidat_ajout.ListeVoeu=ListeVoeu_ajout;
Listecandidat[i]=Candidat_ajout;
voeu* voeu_ajout=(voeu*)malloc(sizeof(voeu));
fread(voeu_ajout->ville,sizeof(char)*31,1,file);
fread(voeu_ajout->dep,sizeof(char)*31,1,file);
fread(&voeu_ajout->ddep,sizeof(int),1,file);
fread(&voeu_ajout->vcand,sizeof(int),1,file);
Candidat_ajout.TabVoeu[i]=voeu_ajout;
}
Tabcandidat[i]=Candidat_ajout;
}
//Je sors en disant que le load est sucessful
printf("Chargement réussie.")
return Listecandidat;
printf("Chargement réussie.");
return Tabcandidat;
}
void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcand)
void SaveCandid(int nbcandidat,candidat *tcandidat)
{
//J'ouvre le fichier
FILE* file;
if((file=fopen("candid.bin","wb"))==NULL)
{
perror("Erreur : ");
exit(1);
}
//J'écris le nombre d'étudiant que je rentres
fwrite(&nbcandidat,sizeof(int),1,file);
//J'écris tout mes étudiants
fwrite(tcandidat,sizeof(candidat),nbcandidat,file);
printf("Sauvegarde réussit");
}
void RechercheCandidat(int ID, int nbcandidat,candidat *tcandidat)
{
for(int i=0;i<nbcandidat;++i)
{
if(i==nbcandidat)
{
printf("Candidat Trouvé :\n
Numéro : %d\n
Nom : %s\n
Prenom : %s\n
Note de mathématique : %f\n
Note de français : %f\n
Note d'anglais : %f\n
Note de spécialité : %f\n
Nombre de candidature : %d\n
Nombre de voeu : %d\n
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[3]);
for(int y=0;y<tcand[i].nbvoeu;++y)
{
printf("Ville : %s\n
Departement : %s\n
Décision département : ",tcandid[i].ListeVoeu[y].ville,tcandid[i].ListeVoeu[y].dep);
if(==0) printf("Dossier non traité\n");
else {
if(==1) printf("Admis\n");
else {
if (==2) printf("Liste d'attente\n");
printf("Candidat Trouvé :\n\
Numéro : %d\n\
Nom : %s\n\
Prenom : %s\n\
Note de mathématique : %f\n\
Note de français : %f\n\
Note d'anglais : %f\n\
Note de spécialité : %f\n\
Nombre de voeu : %d\n\
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[3],tcandidat[i].nbchoix);
for(int y=0;y<tcandidat[i].nbchoix;++y)
{
printf("Ville : %s\n\
Departement : %s\n\
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");
else
{
if(tcandidat[i].TabVoeu[y]->ddep==1) printf("Admis\n");
else
{
if (tcandidat[i].TabVoeu[y]->ddep==2) printf("Liste d'attente\n");
else printf("Refusé\n");
}
}
printf("Décision du candidat : ")
if(==0) printf("Décision non rendu\n");
else {
if(==1) printf("Accepté\n");
else prinf("Refusé");
printf("Décision du candidat : ");
if(tcandidat[i].TabVoeu[y]->vcand==0) printf("Décision non rendu\n");
else
{
if(tcandidat[i].TabVoeu[y]->vcand==1) printf("Accepté\n");
else printf("Refusé");
}
}
return;
}
}
printf("Candidat non trouvé");
}
void ListeCandidat(int nbcandidat,candidat *tcandidat)
{
for(int i=0;i<nbcandidat;++i)
{
printf("Candidat n°%d :\n\
Numéro : %d\n\
Nom : %s\n\
Prenom : %s\n\
Note de mathématique : %f\n\
Note de français : %f\n\
Note d'anglais : %f\n\
Note de spécialité : %f\n\
Nombre de voeu : %d\n\
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[3],tcandidat[i].nbchoix);
for(int y=0;y<tcandidat[i].nbchoix;++y)
{
printf("Ville : %s\n\
Departement : %s\n\
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");
else
{
if(tcandidat[i].TabVoeu[y]->ddep==1) printf("Admis\n");
else
{
if (tcandidat[i].TabVoeu[y]->ddep==2) printf("Liste d'attente\n");
else printf("Refusé\n");
}
}
printf("Décision du candidat : ");
if(tcandidat[i].TabVoeu[y]->vcand==0) printf("Décision non rendu\n");
else
{
if(tcandidat[i].TabVoeu[y]->vcand==1) printf("Accepté\n");
else printf("Refusé");
}
}
return;
}
printf("Candidat non trouvé");
}
void Candidater(VilleIUT* tiut[],int *tlogi, candidat* tcandidat, int numcandid)
{
char VilleRech[31];
printf("Veuillez entrez la ville de l'IUT au quel vous souhaitez candidatez :");
scanf("%s",VilleRech);
int ind=rechercheIUT(tiut,*tlogi,VilleRech);
if(ind==-1) return;
else
{
char DepRech[31];
printf("Veuillez entrez le département dans lequel vous souhaitez y postuler :");
scanf("%s",DepRech);
if (existeDep(tiut[ind]->ldept, DepRech)==0) return;
else
{
int i;
for (i=0;tcandidat[i].numcandid!=numcandid;++i);
voeu* voeu_ajout = (voeu*) malloc (sizeof(voeu));
strcpy(voeu_ajout->ville,VilleRech);
strcpy(voeu_ajout->dep,DepRech);
voeu_ajout->ddep=0;
voeu_ajout->vcand=0;
tcandidat[i].TabVoeu[tcandidat[i].nbchoix]=voeu_ajout;
tcandidat[i].nbchoix++;
}
}
}
//void gestionPhaseCandidatures(); A FAIRE.

@ -1,3 +1,4 @@
typedef struct
{
char ville[31];
@ -11,10 +12,14 @@ typedef struct
int numcandid;
char surname[31];
char name[31];
int note[4];
voeu ListeVoeu[100];
float note[4];
int nbchoix;
voeu* TabVoeu[20];
}candidat;
candidat* LoadCandid(void);
void SaveCandid(int nbcandidat,candidat *tcandidat);
void RechercheCandidat(int ID, int nbcandidat,candidat* tcandidat);
void ListeCandidat(int nbcandidat,candidat *tcandidat);
void Candidater(VilleIUT* tiut[],int *tlogi, candidat* tcandidat,int numcandid);
//void gestionPhaseCandidatures(); A FAIRE.

@ -9,6 +9,7 @@
int main(void)
{
system("clear");
VilleIUT* tiut[36529];
int tlogi=loadIUT(tiut);
menu();
@ -28,6 +29,12 @@ int main(void)
case 'S':
saveIUT(tiut,tlogi);
reset();
break;
case 'Q':
printf("Êtes-vous sûr de vouloir quitter ? (Y pour continuer)\n\n");
scanf("%*c%c",&confirmation);
if(confirmation=='Y') quit=1;
system("clear");
}
saveIUT(tiut,tlogi);
printf("L'application se ferme ...");

Loading…
Cancel
Save