@ -563,7 +563,7 @@ void lancerPhaseCandidature(int *phaseCandidature)
clearpage ( ) ;
}
/*autre*/
int comptClermont ( tCand, int tMax )
int comptClermont ( Candidat * tCand[ ] , int tMax )
{
int i = 0 , compt = 0 , j = 0 ;
for ( i = 0 ; i < tMax ; i + + )
@ -667,7 +667,7 @@ int login(Candidat *tCand[],int *tMax,int *pos) /* Affiche un menu de connexion
}
}
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 */
void menuAdmin ( VilleIUT * tiut [ ] , int * tLog , int tMax , Candidat * tCand [ ] , int tMaxC , 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 , nbClfd ;
@ -771,15 +771,15 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileC
lancerPhaseCandidature ( phaseCandidature ) ;
if ( * phaseCandidature = = 2 )
{
nbClfd = comptClermont ( tCand , tMax ) ;
nbClfd = comptClermont ( tCand , tMax C ) ;
tIntermediaire = ( Candidat * * ) malloc ( nbClfd * sizeof ( Candidat * ) ) ;
if ( tIntermediaire = = NULL )
{
printf ( " Problème d'allocation \n " ) ;
exit ( 1 ) ;
}
tIntermediaire = remplirCandCl ( tCand , tIntermediaire , tMax , nbClfd ) ;
* f = insertFile ( tIntermediaire , tMax ) ;
tIntermediaire = remplirCandCl ( tCand , tIntermediaire , tMax C , nbClfd ) ;
* f = insertFile ( tIntermediaire , nbClfd ) ;
}
}
printf ( " __________________________________________________________ \n " ) ;
@ -800,11 +800,12 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileC
}
}
void menuCandidat ( VilleIUT * tiut [ ] , int * tLog , int tMax , Candidat * tCand [ ] , int tMaxC , int posC , 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 ,float mini )
{
int select , pos , i , retour , majChoix , j = 0 ;
char ville [ 31 ] , dept [ 31 ] ;
int trouve ;
ListeCand suppr ;
MaillonDept * m ;
system ( " clear " ) ;
printf ( " ______________________________________________________________ \n " ) ;
@ -936,7 +937,17 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
if ( retour = = - 1 )
{
while ( j < tCand [ pos ] - > nombreChoix )
{
if ( strcmp ( tCand [ pos ] - > tChoix [ j ] - > ville , " Clermont-Ferrand " ) = = 0 & & strcmp ( tCand [ pos ] - > tChoix [ j ] - > dep , " Informatique " ) = = 0 )
{
tCand [ pos ] - > tChoix [ j ] - > decisionCand = - 1 ;
break ;
}
}
suppr = rechercherCandListe ( * ladmis , tCand [ pos ] - > numeroC , & trouve ) ;
* ladmis = supprimerCand ( * ladmis , tCand [ pos ] ) ;
* f = fileToAdmis ( * f , ladmis , 1 , mini ) ;
}
}
}
@ -964,41 +975,90 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
void menuResp ( Candidat * tCand [ ] , int tMax , int phaseCandidature , FileCand * f , ListeCand * ladmis )
void menuResp ( Candidat * tCand [ ] , int tMax , int phaseCandidature , FileCand * f , ListeCand * ladmis , float * mini )
{
int select = 0 ;
while ( select ! = 9 )
{
int admis , deci , trouve , pos , posC , i ;
float mini ;
system ( " clear " ) ;
printf ( " Quel est le nombre de candidat admis ? \t " ) ;
scanf ( " %d%*c " , & admis ) ;
printf ( " \n Quelle moyenne minimale les candidats doivent avoir ? \t " ) ;
scanf ( " %f " , & mini ) ;
printf ( " \n \n Voici les candidats ayant sélectionner votre département : \t " ) ;
printf ( " ___________________________________________________________ \n " ) ;
printf ( " | Menu Responsable | \n " ) ;
printf ( " |---------------------------------------------------------| \n " ) ;
printf ( " | 1 Déclarez une moyenne minimale (obligatoire) | \n " ) ;
printf ( " | 2 Gérer les admissions | \n " ) ;
printf ( " | 3 Afficher la liste des admissions ou la file d'attente | \n " ) ;
printf ( " | 9 Quitter | \n " ) ;
printf ( " |_________________________________________________________| \n " ) ;
printf ( " \n Saisie : \t " ) ;
scanf ( " %d%*c " , & select ) ;
if ( select = = 1 )
{
printf ( " Quelle est la moyenne minimale pour entrer dans votre département? \t " ) ;
scanf ( " %f " , mini ) ;
}
if ( select = = 2 )
{
gererAdmis ( f , ladmis , * mini ) ;
}
if ( select = = 3 )
{
afficherCandidatsParCategorie ( * f , * ladmis ) ;
}
}
clearpage ( ) ;
}
void gererAdmis ( FileCand * f , ListeCand * l , float mini )
{
int select = 0 , admis , i = 0 ;
char choix ;
Candidat * c ;
while ( select ! = 9 )
{
system ( " clear " ) ;
printf ( " 1 Accepter des candidats \n " ) ;
printf ( " 2 Refuser des candidats \n " ) ;
printf ( " 9 Quitter \n " ) ;
scanf ( " %d%*c " , & select ) ;
if ( select = = 1 )
{
afficher ( * f ) ;
printf ( " Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter) \t " ) ;
scanf ( " %d%*c " , & deci ) ;
while ( deci ! = 0 )
printf ( " \n Combien de candidats voulez vous accepter? \t " ) ;
scanf ( " %d%*c " , & admis ) ;
* f = fileToAdmis ( * f , l , admis , mini ) ;
afficherListeCand ( * l ) ;
}
if ( select = = 2 )
{
pos = rechercherCandidat ( tCand , tMax , deci , & trouve ) ;
if ( trouve = = 1 )
c = tete ( * f ) ;
afficherCandidat ( c ) ;
printf ( " Refuser le candidat?(o/n) " ) ;
scanf ( " %c " , & choix ) ;
if ( choix = = ' o ' | | choix = = ' O ' )
{
* f = supt ( * f ) ;
while ( i < c - > nombreChoix )
{
posC = rechercherChoix ( tCand [ pos ] - > tChoix , tCand [ pos ] - > nombreChoix , " Clermont-Ferrand " , " Informatique " , & trouve ) ;
tCand [ pos ] - > tChoix [ posC ] - > decisionResp = - 1 ;
if ( strcmp ( c - > tChoix [ i ] - > ville , " Clermont-Ferrand " ) = = 0 & & strcmp ( c - > tChoix [ i ] - > dep , " Informatique " ) = = 0 )
{
c - > tChoix [ i ] - > decisionResp = - 1 ;
}
i + + ;
}
}
else printf ( " Mauvais numéro. Taper 0 pour quitter \n " ) ;
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 ) ;
printf ( " Voi " ) ;
}
clearpage ( ) ;
}
FileCand fileToAdmis ( FileCand f , ListeCand * l , int nbAdmis )
FileCand fileToAdmis ( FileCand f , ListeCand * l , int nbAdmis ,float mini )
{
int j ;
Candidat * c ;
while ( nbAdmis ! = 0 )
{
if ( f . t - > c - > moyenne > = mini )
{
c = f . t - > c ;
f = supt ( f ) ;
@ -1012,6 +1072,8 @@ FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis)
}
nbAdmis - - ;
}
else f = supt ( f ) ;
}
return f ;
}
@ -1059,6 +1121,7 @@ void clearpage(void) /* Permet de demander à l'utilisateur pour continuer à la
void globale ( void ) /* Permet l'initialisation du tableau, le chargement de celui-ci et l'appel des fonctions login, menus et enregistrement */
{
int tLog , retour , tMax , numC , phaseCandidature = 0 , pos ;
float mini ;
Candidat * * tCand ;
VilleIUT * tiut [ 100 ] ; /* Déclaration du tableau de pointeurs tiut */
FileCand f ;
@ -1083,16 +1146,16 @@ void globale(void) /* Permet l'initialisation du tableau, le chargement de celui
{
if ( retour = = 1 )
{
menuAdmin ( tiut , & tLog , 100 , & phaseCandidature ) ;
menuAdmin ( tiut , & tLog , 100 , tCand , tMax , & phaseCandidature , & f , & ladmis ) ;
}
if ( retour = = 0 )
{
menuCandidat ( tiut , & tLog , 100 , tCand , tMax , pos , phaseCandidature );
menuCandidat ( tiut , & tLog , 100 , tCand , tMax , pos , phaseCandidature ,& f , & ladmis , mini );
}
retour = login ( tCand , & tMax , & pos ) ;
if ( retour = = 3 )
{
menuResp ( tCand , tMax ;phaseCandidature ) ;
menuResp ( tCand , tMax ,phaseCandidature , & f , & ladmis , & mini ) ;
}
}
enregistrement ( tiut , tLog ) ;
@ -1884,7 +1947,7 @@ Candidat** remplirCandCl(Candidat *tCand[], Candidat *tempC[], int tMax, int nbC
{
for ( j = 0 ; j < tCand [ i ] - > nombreChoix ; j + + )
{
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 )
{
tempC [ k ] = tCand [ i ] ;
k = k + 1 ;
@ -1918,3 +1981,23 @@ int plusGrandCandTemp(Candidat *tCand[], int nbCl) /* Fonction permettant de tro
}
return maxi ;
}
void afficherCandidatsParCategorie ( FileCand f , ListeCand l )
{
int categ , i , pos , trouve ;
printf ( " Quelle catégorie de candidats souhaitez-vous afficher ? (admis = 1 / attente = 2) \n Saisie : " ) ;
scanf ( " %d%*c " , & categ ) ;
printf ( " \n " ) ;
if ( categ = = 1 )
{
afficherListeCand ( l ) ;
}
}
void afficherListeCand ( ListeCand l )
{
while ( l - > suiv ! = NULL )
{
afficherCandidat ( l - > c ) ;
}
}