@ -766,16 +766,20 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileC
}
}
}
if ( select = = 8 )
{
lancerPhaseCandidature ( phaseCandidature ) ;
if ( * phaseCandidature = = 2 )
{
nbClfd = comptClermont ( tCand , tMax ) ;
* tIntermediaire = ( Candidat * * ) malloc ( nbClfd * sizeof ( Candidat * ) ) ;
//fonction johnny
* f = insertFile ( * * , tMax ) ;
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 ) ;
}
}
printf ( " __________________________________________________________ \n " ) ;
@ -970,7 +974,7 @@ void menuResp(Candidat *tCand[],int tMax,int phaseCandidature,FileCand *f,ListeC
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 " ) ;
afficher ( f ) ;
afficher ( * f ) ;
printf ( " Voulez-vous en refuser ? (insérer son numéro ou 0 pour quitter) \t " ) ;
scanf ( " %d%*c " , & deci ) ;
while ( deci ! = 0 )
@ -999,29 +1003,45 @@ FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis)
c = f . t - > c ;
f = supt ( f ) ;
* l = insererCandEntete ( * l , c ) ;
for ( j = 0 ; j < c - > nombreChoix ; j + + )
{
if ( strcmp ( c - > tChoix [ j ] - > ville , " Clermont-Ferrand " ) = = 0 & & strcmp ( c - > tChoix [ j ] - > dep , " Informatique " ) = = 0 )
{
c - > tChoix [ j ] - > decisionResp = 1 ;
}
}
nbAdmis - - ;
}
return f ;
}
FileCand insertFile ( Candidat * tCand [ ] , int tMax )
FileCand insertFile ( Candidat * tCand [ ] , int nbClfd )
{
int i , j ;
int i , j ;
FileCand f ;
f = filenouv ( ) ;
for ( i = 0 ; i < tMax ; i + + )
for ( i = 0 ; i < nbClfd ; i + + )
{
for ( j= 0 ; j < tCand[ i ] - > nombreChoix; j + + )
i f( tCand[ i ] - > moyenne > = 12.0 )
{
if( strcmp ( tCand [ i ] - > tChoix [ j ] - > ville , " Clermont-Ferrand " ) = = 0 & & strcmp ( tCand [ i ] - > tChoix [ j ] - > dep , " Informatique " ) = = 0 )
f = adjq ( f , tCand [ i ] ) ;
for( j = 0 ; j < tCand [ i ] - > nombreChoix ; j + + )
{
f = adjq ( f , tCand [ i ] ) ;
tCand [ i ] - > tChoix [ j ] - > decisionResp = 2 ;
if ( strcmp ( tCand [ i ] - > tChoix [ j ] - > ville , " Clermont-Ferrand " ) = = 0 & & strcmp ( tCand [ i ] - > tChoix [ j ] - > dep , " Informatique " ) = = 0 )
{
tCand [ i ] - > tChoix [ j ] - > decisionResp = 2 ;
}
}
}
else
{
if ( strcmp ( tCand [ i ] - > tChoix [ j ] - > ville , " Clermont-Ferrand " ) = = 0 & & strcmp ( tCand [ i ] - > tChoix [ j ] - > dep , " Informatique " ) = = 0 )
{
tCand [ i ] - > tChoix [ j ] - > decisionResp = - 1 ;
}
}
}
return f ;
}
@ -1856,3 +1876,45 @@ ListeCand rechercherCandListe(ListeCand lCand, int numeroC, int *trouve) /* Per
}
return rechercherCandListe ( lCand - > suiv , numeroC , trouve ) ; /* Si aucune condition n'est respectée, renvoie la même recherche pour le maillon suivant */
}
Candidat * * remplirCandCl ( Candidat * tCand [ ] , Candidat * tempC [ ] , int tMax , int nbCl ) /* Permet d'insérer une ville dans le tableau tiut et renvoie un entier dépendant du déroulement de l'insertion */
{
int i , j , k = 0 ;
for ( i = 0 ; i > tMax ; i + + ) /* On décale tous les éléments vers la droite depuis le dernier élément du tableau jusqu'à la position d'insertion passée en paramètre */
{
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 )
{
tempC [ k ] = tCand [ i ] ;
k = k + 1 ;
}
}
}
triTemp ( tempC , nbCl ) ;
return tempC ;
}
void triTemp ( Candidat * tCand [ ] , int nbCl ) /* Fonction permettant de trier un tableau de candidats en effectuant un tri par échange */
{
int maxi ;
while ( nbCl > 1 )
{
plusGrandCandTemp ( tCand , nbCl ) ; /* Appel de la fonction plusGrand pour déterminer le plus grand élément du tableau */
echangerCand ( tCand , maxi , nbCl - 1 ) ; /* Appel de la fonction échange pour placer le plus grnad élément du tableau en dernière position */
nbCl = nbCl - 1 ;
}
}
int plusGrandCandTemp ( Candidat * tCand [ ] , int nbCl ) /* Fonction permettant de trouver le plus grand élément du tableau candidat en le parcourant et en*/
{ /* comparant ses éléments. Elle renvoie ensuite l'indice du plus grand élément */
int maxi = 0 , i ;
for ( i = 1 ; i < nbCl ; i + + )
{
if ( tCand [ i ] - > moyenne > tCand [ maxi ] - > moyenne )
{
maxi = i ;
}
}
return maxi ;
}