Correction menus

master
Maël DAIM 2 years ago
parent 550a1081a9
commit 5640994c23

@ -766,16 +766,20 @@ void menuAdmin(VilleIUT *tiut[], int *tLog, int tMax,int *phaseCandidature,FileC
} }
} }
} }
if(select==8) if(select==8)
{ {
lancerPhaseCandidature(phaseCandidature); lancerPhaseCandidature(phaseCandidature);
if (*phaseCandidature==2) if (*phaseCandidature==2)
{ {
nbClfd=comptClermont(tCand,tMax); nbClfd=comptClermont(tCand,tMax);
*tIntermediaire=(Candidat **)malloc(nbClfd*sizeof(Candidat*)); tIntermediaire=(Candidat **)malloc(nbClfd*sizeof(Candidat*));
//fonction johnny if(tIntermediaire==NULL)
*f=insertFile(**,tMax); {
printf("Problème d'allocation\n");
exit(1);
}
tIntermediaire=remplirCandCl(tCand,tIntermediaire,tMax,nbClfd);
*f=insertFile(tIntermediaire,tMax);
} }
} }
printf("__________________________________________________________\n"); printf("__________________________________________________________\n");
@ -970,7 +974,7 @@ void menuResp(Candidat *tCand[],int tMax,int phaseCandidature,FileCand *f,ListeC
printf("\nQuelle moyenne minimale les candidats doivent avoir ?\t"); printf("\nQuelle moyenne minimale les candidats doivent avoir ?\t");
scanf("%f",&mini); scanf("%f",&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");
scanf("%d%*c",&deci); scanf("%d%*c",&deci);
while (deci!=0) while (deci!=0)
@ -999,30 +1003,46 @@ FileCand fileToAdmis(FileCand f, ListeCand *l, int nbAdmis)
c=f.t->c; c=f.t->c;
f=supt(f); f=supt(f);
*l=insererCandEntete(*l,c); *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--; nbAdmis--;
} }
return f; return f;
} }
FileCand insertFile(Candidat *tCand[],int tMax) FileCand insertFile(Candidat *tCand[],int nbClfd)
{ {
int i, j; int i, j;
FileCand f; FileCand f;
f=filenouv(); f=filenouv();
for(i=0;i<tMax;i++) for(i=0;i<nbClfd;i++)
{ {
if(tCand[i]->moyenne >= 12.0)
{
f=adjq(f,tCand[i]);
for(j = 0; j < tCand[i]->nombreChoix; j++) 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)
{ {
f=adjq(f,tCand[i]);
tCand[i]->tChoix[j]->decisionResp = 2; 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; 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 */ 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;
}

@ -194,3 +194,8 @@ bool videListe(ListeCand lCand);
ListeCand rechercherCandListe(ListeCand lCand, int numeroC, int *trouve); ListeCand rechercherCandListe(ListeCand lCand, int numeroC, int *trouve);
void afficher(FileCand f); void afficher(FileCand f);
Candidat** remplirCandCl(Candidat *tCand[], Candidat *tempC[], int tMax, int nbCl);
void triTemp(Candidat *tCand[], int nbCl);
int plusGrandCandTemp(Candidat *tCand[], int nbCl);
Loading…
Cancel
Save