From 90c456b8cc2a8bf12e9b0c7577d8b69414c3fa1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20DAIM?= Date: Fri, 13 Jan 2023 09:40:34 +0100 Subject: [PATCH] correction --- Msae.c | 96 ++++++++++++++++++++++++++++++++++++++-------------------- Msae.h | 11 ++++--- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/Msae.c b/Msae.c index 81bfc28..4d25752 100644 --- a/Msae.c +++ b/Msae.c @@ -540,32 +540,47 @@ void lancerPhaseCandidature(int *phaseCandidature) if(choix!='O' && choix!='o') { printf("La phase de candidature n'a pas été lancée.\n"); - scanf("%c%*c",&choix); clearpage(); return; } *phaseCandidature=1; 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;inombreChoix;j++) { - printf("La phase de candidature n'a pas été arrêtée.\n"); - scanf("%c%*c",&choix); - clearpage(); - return; + + if(strcmp(tCand[i]->tChoix[j]->ville,"Clermont-Ferrand")==0 && strcmp(tCand[i]->tChoix[j]->dep,"Informatique")==0) + { + compt++; + } } - *phaseCandidature=2; - printf("\nLa phase de candidature a été arrêtée.\n"); } - - clearpage(); + return compt; } + // ########################################################################################### // ########################################################################################### // ################################ 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 */ { 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); 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 trouve; + int trouve,nbClfd; char ville[31], choix; + Candidat **tIntermediaire; ListeDept l; printf("__________________________________________________________\n"); printf("| MENU ADMIN |\n"); @@ -750,6 +770,13 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature) /* A if(select==8) { lancerPhaseCandidature(phaseCandidature); + if (*phaseCandidature==2) + { + nbClfd=comptClermont(tCand,tMax); + *tIntermediaire=(Candidat **)malloc(nbClfd*sizeof(Candidat*)); + //fonction johnny + *f=insertFile(**,tMax); + } } printf("__________________________________________________________\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; 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("|------------------------------------------------------------|\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("| 4 Afficher les IUT possédant le département voulu |\n"); printf("| 5 Afficher vos choix |\n"); @@ -873,7 +900,7 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM clearpage(); } } - if(phaseCandidature=2) + if(phaseCandidature==2) { if(select == 8) { @@ -903,7 +930,10 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM } 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; float mini; - FileCand f; - ListeCand ladmis; system("clear"); printf("Quel est le nombre de candidat admis ?\t"); scanf("%d%*c",&admis); printf("\nQuelle moyenne minimale les candidats doivent avoir ?\t"); scanf("%f",&mini); - f=insertCroiFile(tCand,tMax,mini); printf("\n\nVoici les candidats ayant sélectionner votre département :\t"); afficher(f); 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"); scanf("%d%*c",&deci); } - ladmis=listeCandNouv(); - f=fileToAdmis(f,&ladmis,admis); + *ladmis=listeCandNouv(); + *f=fileToAdmis(*f,ladmis,admis); 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; 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(tCand[i]->moyenne>=mini) - { - f=adjq(f,tCand[i]); - tCand[i]->tChoix[j]->decisionResp=2; - } - else tCand[i]->tChoix[j]->decisionResp=-1; + + f=adjq(f,tCand[i]); + tCand[i]->tChoix[j]->decisionResp=2; } } } @@ -1017,6 +1041,8 @@ void globale(void) /* Permet l'initialisation du tableau, le chargement de celui int tLog, retour,tMax,numC,phaseCandidature=0,pos; Candidat **tCand; 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 */ { 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); } retour = login(tCand,&tMax,&pos); + if(retour==3) + { + menuResp(tCand,tMax;phaseCandidature); + } } enregistrement(tiut, tLog); } diff --git a/Msae.h b/Msae.h index 719bf84..f603c48 100644 --- a/Msae.h +++ b/Msae.h @@ -111,15 +111,16 @@ void lancerPhaseCandidature(int *phaseCandidature); // ########################################################################################### int login(Candidat *tCand[],int *tMax,int *pos); -void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax, int *phaseCandidature); -void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tMaxC,int posC,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,FileCand *f,ListeCand *ladmis); void clearpage(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*/ -FileCand insertCroiFile(Candidat *tCand[],int tMax,float mini); +FileCand insertFile(Candidat *tCand[],int tMax); FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis); - +/*autre*/ +int comptClermont(tCand,int tMax); // ########################################################################################### // ########################################################################################### // ################################ Partie II ################################################