master
Maël DAIM 2 years ago
parent bdb7fa21ad
commit 90c456b8cc

@ -540,32 +540,47 @@ void lancerPhaseCandidature(int *phaseCandidature)
if(choix!='O' && choix!='o') if(choix!='O' && choix!='o')
{ {
printf("La phase de candidature n'a pas été lancée.\n"); printf("La phase de candidature n'a pas été lancée.\n");
scanf("%c%*c",&choix);
clearpage(); clearpage();
return; return;
} }
*phaseCandidature=1; *phaseCandidature=1;
printf("\nLa phase de candidature a été lancée.\n"); printf("\nLa phase de candidature a été lancée.\n");
} }
if(*phaseCandidature==1) else if(*phaseCandidature==1)
{
printf("La phase de candidature est en court.\n");
printf("\nÊtes-vous sur d'arrêter la phase de candidature?(o/n)\t");
scanf("%c%*c",&choix);
if(choix!='O' && choix!='o')
{
printf("La phase de candidature n'a pas été arrêtée.\n");
clearpage();
return;
}
*phaseCandidature=2;
printf("\nLa phase de candidature a été arrêtée.\n");
}
clearpage();
}
/*autre*/
int comptClermont(tCand,int tMax)
{
int i=0,compt=0,j=0;
for(i=0;i<tMax;i++)
{ {
printf("La phase de candidature est en court.\n"); for(j=0;j<tCand[i]->nombreChoix;j++)
printf("\nÊtes-vous sur d'arrêter la phase de candidature?(o/n)\t");
scanf("%c%*c",&choix);
if(choix!='O' && choix!='o')
{ {
printf("La phase de candidature n'a pas été arrêtée.\n");
scanf("%c%*c",&choix); if(strcmp(tCand[i]->tChoix[j]->ville,"Clermont-Ferrand")==0 && strcmp(tCand[i]->tChoix[j]->dep,"Informatique")==0)
clearpage(); {
return; compt++;
}
} }
*phaseCandidature=2;
printf("\nLa phase de candidature a été arrêtée.\n");
} }
return compt;
clearpage();
} }
// ########################################################################################### // ###########################################################################################
// ########################################################################################### // ###########################################################################################
// ################################ Commun au 2 parties ###################################### // ################################ Commun au 2 parties ######################################
@ -586,7 +601,7 @@ int login(Candidat *tCand[],int *tMax,int *pos) /* Affiche un menu de connexion
while(id != 'A' && id != 'a' && id != 'C' && id != 'c') /* Effectue une saisie contrôlée si la saisie ne correspond à aucune option */ while(id != 'A' && id != 'a' && id != 'C' && id != 'c') /* Effectue une saisie contrôlée si la saisie ne correspond à aucune option */
{ {
system("clear"); system("clear");
printf("\t#################### Mauvaise saisie ('q' pour quitter) ####################\nSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur? (C/A)\nSaisie : "); printf("\t#################### Mauvaise saisie ('q' pour quitter) ####################\nSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur ou en tant que responsable? (C/A/R)\nSaisie : ");
scanf("%c%*c",&id); scanf("%c%*c",&id);
if(id == 'q') if(id == 'q')
{ {
@ -646,13 +661,18 @@ int login(Candidat *tCand[],int *tMax,int *pos) /* Affiche un menu de connexion
} }
} }
if(id == 'R' || id == 'r')
{
return 3;
}
} }
void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature) /* Affiche un menu de choix adaptés pour un administrateur et appelle les fonctions en conséquence */ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileCand *f,ListeCand *ladmis) /* Affiche un menu de choix adaptés pour un administrateur et appelle les fonctions en conséquence */
{ {
int select, pos; int select, pos;
int trouve; int trouve,nbClfd;
char ville[31], choix; char ville[31], choix;
Candidat **tIntermediaire;
ListeDept l; ListeDept l;
printf("__________________________________________________________\n"); printf("__________________________________________________________\n");
printf("| MENU ADMIN |\n"); printf("| MENU ADMIN |\n");
@ -750,6 +770,13 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature) /* A
if(select==8) if(select==8)
{ {
lancerPhaseCandidature(phaseCandidature); lancerPhaseCandidature(phaseCandidature);
if (*phaseCandidature==2)
{
nbClfd=comptClermont(tCand,tMax);
*tIntermediaire=(Candidat **)malloc(nbClfd*sizeof(Candidat*));
//fonction johnny
*f=insertFile(**,tMax);
}
} }
printf("__________________________________________________________\n"); printf("__________________________________________________________\n");
printf("| MENU ADMIN |\n"); printf("| MENU ADMIN |\n");
@ -769,7 +796,7 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature) /* A
} }
} }
void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int posC,int phaseCandidature) void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int posC,int phaseCandidature,FileCand *f,ListeCand *ladmis)
{ {
int select, pos,i,retour,majChoix,j=0; int select, pos,i,retour,majChoix,j=0;
char ville[31], dept[31]; char ville[31], dept[31];
@ -784,7 +811,7 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
printf("| Que souhaitez-vous faire ? |\n"); printf("| Que souhaitez-vous faire ? |\n");
printf("|------------------------------------------------------------|\n"); printf("|------------------------------------------------------------|\n");
printf("| 1 Afficher les villes où il y a un IUT |\n"); printf("| 1 Afficher les villes où il y a un IUT |\n");
printf("| 2 Afficher tous les départements dans chaque IUT |\n"); printf("| 2 Afficher tous les départements dans un IUT |\n");
printf("| 3 Nombres de places en première année |\n"); printf("| 3 Nombres de places en première année |\n");
printf("| 4 Afficher les IUT possédant le département voulu |\n"); printf("| 4 Afficher les IUT possédant le département voulu |\n");
printf("| 5 Afficher vos choix |\n"); printf("| 5 Afficher vos choix |\n");
@ -873,7 +900,7 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
clearpage(); clearpage();
} }
} }
if(phaseCandidature=2) if(phaseCandidature==2)
{ {
if(select == 8) if(select == 8)
{ {
@ -903,7 +930,10 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
} }
majChoix=1; majChoix=1;
} }
if(retour==-1)
{
}
} }
} }
} }
@ -930,18 +960,15 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
} }
void menuResp(Candidat *tCand[],int tMax,int phaseCandidature) void menuResp(Candidat *tCand[],int tMax,int phaseCandidature,FileCand *f,ListeCand *ladmis)
{ {
int admis,deci,trouve,pos,posC,i; int admis,deci,trouve,pos,posC,i;
float mini; float mini;
FileCand f;
ListeCand ladmis;
system("clear"); system("clear");
printf("Quel est le nombre de candidat admis ?\t"); printf("Quel est le nombre de candidat admis ?\t");
scanf("%d%*c",&admis); scanf("%d%*c",&admis);
printf("\nQuelle moyenne minimale les candidats doivent avoir ?\t"); printf("\nQuelle moyenne minimale les candidats doivent avoir ?\t");
scanf("%f",&mini); scanf("%f",&mini);
f=insertCroiFile(tCand,tMax,mini);
printf("\n\nVoici les candidats ayant sélectionner votre département :\t"); printf("\n\nVoici les candidats ayant sélectionner votre département :\t");
afficher(f); afficher(f);
printf("Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter)\t"); printf("Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter)\t");
@ -958,8 +985,8 @@ void menuResp(Candidat *tCand[],int tMax,int phaseCandidature)
printf("Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter)\t"); printf("Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter)\t");
scanf("%d%*c",&deci); scanf("%d%*c",&deci);
} }
ladmis=listeCandNouv(); *ladmis=listeCandNouv();
f=fileToAdmis(f,&ladmis,admis); *f=fileToAdmis(*f,ladmis,admis);
printf("Voi"); printf("Voi");
} }
@ -978,7 +1005,7 @@ FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis)
} }
FileCand insertCroiFile(Candidat *tCand[],int tMax,float mini) FileCand insertFile(Candidat *tCand[],int tMax)
{ {
int i,j; int i,j;
FileCand f; FileCand f;
@ -990,12 +1017,9 @@ FileCand insertCroiFile(Candidat *tCand[],int tMax,float mini)
if(strcmp(tCand[i]->tChoix[j]->ville,"Clermont-Ferrand")==0 && strcmp(tCand[i]->tChoix[j]->dep,"Informatique")==0) if(strcmp(tCand[i]->tChoix[j]->ville,"Clermont-Ferrand")==0 && strcmp(tCand[i]->tChoix[j]->dep,"Informatique")==0)
{ {
if(tCand[i]->moyenne>=mini)
{ f=adjq(f,tCand[i]);
f=adjq(f,tCand[i]); tCand[i]->tChoix[j]->decisionResp=2;
tCand[i]->tChoix[j]->decisionResp=2;
}
else tCand[i]->tChoix[j]->decisionResp=-1;
} }
} }
} }
@ -1017,6 +1041,8 @@ void globale(void) /* Permet l'initialisation du tableau, le chargement de celui
int tLog, retour,tMax,numC,phaseCandidature=0,pos; int tLog, retour,tMax,numC,phaseCandidature=0,pos;
Candidat **tCand; Candidat **tCand;
VilleIUT *tiut[100]; /* Déclaration du tableau de pointeurs tiut */ VilleIUT *tiut[100]; /* Déclaration du tableau de pointeurs tiut */
FileCand f;
ListeCand ladmis;
if(tiut == NULL) /* En cas de problème de mémoire, affiche un message d'erreur et quitte le programme */ if(tiut == NULL) /* En cas de problème de mémoire, affiche un message d'erreur et quitte le programme */
{ {
printf("Problème d'allocation mémoire du tableau tiut\n"); printf("Problème d'allocation mémoire du tableau tiut\n");
@ -1044,6 +1070,10 @@ void globale(void) /* Permet l'initialisation du tableau, le chargement de celui
menuCandidat(tiut, &tLog, 100,tCand,tMax,pos,phaseCandidature); menuCandidat(tiut, &tLog, 100,tCand,tMax,pos,phaseCandidature);
} }
retour = login(tCand,&tMax,&pos); retour = login(tCand,&tMax,&pos);
if(retour==3)
{
menuResp(tCand,tMax;phaseCandidature);
}
} }
enregistrement(tiut, tLog); enregistrement(tiut, tLog);
} }

@ -111,15 +111,16 @@ void lancerPhaseCandidature(int *phaseCandidature);
// ########################################################################################### // ###########################################################################################
int login(Candidat *tCand[],int *tMax,int *pos); int login(Candidat *tCand[],int *tMax,int *pos);
void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax, int *phaseCandidature); void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax, int *phaseCandidature,FileCand *f,ListeCand *ladmis);
void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int posC,int phaseCandidature); void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int posC,int phaseCandidature,FileCand *f,ListeCand *ladmis);
void clearpage(void); void clearpage(void);
void globale(void); void globale(void);
void menuResp(Candidat *tCand[],int tMax,int phaseCandidature); void menuResp(Candidat *tCand[],int tMax,int phaseCandidature,FileCand *f,ListeCand *ladmis);
/*Pour menuResp*/ /*Pour menuResp*/
FileCand insertCroiFile(Candidat *tCand[],int tMax,float mini); FileCand insertFile(Candidat *tCand[],int tMax);
FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis); FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis);
/*autre*/
int comptClermont(tCand,int tMax);
// ########################################################################################### // ###########################################################################################
// ########################################################################################### // ###########################################################################################
// ################################ Partie II ################################################ // ################################ Partie II ################################################

Loading…
Cancel
Save