Ajout de la fonction d'affichage en fonction de la catégorie du candidat

master
Johnny RATTON 2 years ago
parent 761deb7321
commit c10c46a47c

@ -853,6 +853,7 @@ void enregistrement(VilleIUT *tiut[],int tLog) /* Permet l'enregistrement du tab
// ########################################################################################### // ###########################################################################################
// ########################################################################################### // ###########################################################################################
/************************************** Fonctions de Chargement ********************************************/ /************************************** Fonctions de Chargement ********************************************/
/****************************************** Et de sauvegarde*************************************************/ /****************************************** Et de sauvegarde*************************************************/
/************************************************************************************************************/ /************************************************************************************************************/
@ -1022,6 +1023,27 @@ void afficherCandDep(Candidat *tCand[], int tMax) /* Fonction permettant d'affic
} }
void afficherCandidatsParCatégorie(Candidat *tCand[], char ville[], char dep[], int tMax)
{
int categ, i, pos, trouve;
printf("Quelle catégorie de candidats souhaitez-vous afficher ? (admis = 1 / attente = 2)\nSaisie : ");
saisie("%d%*c", &categ);
printf("\n");
for(i = 0; i < tMax; i++)
{
pos = rechercherChoix(tCand[i]->tChoix, nombreChoix, ville, dep, &trouve);
if(trouve == 1)
{
if(tCand[i]->tChoix[pos]->decisionResp == categ)
{
afficherCandidat(tCand[i]);
afficherChoix(tCand[i]->tChoix[pos]);
}
}
}
}
/************************************ Fonctions de réallocation *********************************************/ /************************************ Fonctions de réallocation *********************************************/
/************************************************************************************************************/ /************************************************************************************************************/
/************************************************************************************************************/ /************************************************************************************************************/
@ -1070,6 +1092,13 @@ int plusGrandCand(Candidat *tCand[], int tMax) /* Fonction permettant de trouver
int maxi = 0, i; int maxi = 0, i;
for(i = 1; i < tMax; i++) for(i = 1; i < tMax; i++)
{ {
if(strcmp(tCand[i]->nom, tCand[maxi]->nom) == 0)
{
if(strcmp(tCand[i]->prenom, tCand[maxi]->prenom) > 0)
{
maxi = i;
}
}
if(strcmp(tCand[i]->nom, tCand[maxi]->nom) > 0) if(strcmp(tCand[i]->nom, tCand[maxi]->nom) > 0)
{ {
maxi = i; maxi = i;
@ -1674,7 +1703,7 @@ ListeCand rechercherCandListe(ListeCand lCand, int numeroC, int *trouve) /* Per
/************************************************************************************************************/ /************************************************************************************************************/
/************************************************************************************************************/ /************************************************************************************************************/
void globale(void) /* Permet de gérer l'exécution du programme */ void globale2(void) /* Permet de gérer l'exécution du programme */
{ {
int tMax, pos, trouve, i = 0, j, mini = i; int tMax, pos, trouve, i = 0, j, mini = i;
Candidat **tCand, c, **aux, *temp; /* Initialisation du tableau de candidats */ Candidat **tCand, c, **aux, *temp; /* Initialisation du tableau de candidats */
@ -1703,7 +1732,7 @@ void globale(void) /* Permet de gérer l'exécution du programme */
sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */ sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */
} }
void menuCandidat(Candidat *tCand[], int tMax) /* Fonction affichant un menu adapté pour un candidat */ void menuCandidat2(Candidat *tCand[], int tMax) /* Fonction affichant un menu adapté pour un candidat */
{ {
int pos,trouve, saisie, i, numeroC; int pos,trouve, saisie, i, numeroC;
system("clear"); system("clear");

@ -169,6 +169,27 @@ void afficherCandDep(Candidat *tCand[], int tMax) /* Fonction permettant d'affic
} }
void afficherCandidatsParCatégorie(Candidat *tCand[], char ville[], char dep[], int tMax)
{
int categ, i, pos, trouve;
printf("Quelle catégorie de candidats souhaitez-vous afficher ? (admis = 1 / attente = 2)\nSaisie : ");
saisie("%d%*c", &categ);
printf("\n");
for(i = 0; i < tMax; i++)
{
pos = rechercherChoix(tCand[i]->tChoix, nombreChoix, ville, dep, &trouve);
if(trouve == 1)
{
if(tCand[i]->tChoix[pos]->decisionResp == categ)
{
afficherCandidat(tCand[i]);
afficherChoix(tCand[i]->tChoix[pos]);
}
}
}
}
/************************************ Fonctions de réallocation *********************************************/ /************************************ Fonctions de réallocation *********************************************/
/************************************************************************************************************/ /************************************************************************************************************/
/************************************************************************************************************/ /************************************************************************************************************/
@ -217,6 +238,13 @@ int plusGrandCand(Candidat *tCand[], int tMax) /* Fonction permettant de trouver
int maxi = 0, i; int maxi = 0, i;
for(i = 1; i < tMax; i++) for(i = 1; i < tMax; i++)
{ {
if(strcmp(tCand[i]->nom, tCand[maxi]->nom) == 0)
{
if(strcmp(tCand[i]->prenom, tCand[maxi]->prenom) > 0)
{
maxi = i;
}
}
if(strcmp(tCand[i]->nom, tCand[maxi]->nom) > 0) if(strcmp(tCand[i]->nom, tCand[maxi]->nom) > 0)
{ {
maxi = i; maxi = i;
@ -845,7 +873,7 @@ void globale2(void) /* Permet de gérer l'exécution du programme */
tCand[i] = tCand[mini]; tCand[i] = tCand[mini];
tCand[mini] = temp; tCand[mini] = temp;
} }
//menuCandidat2(tCand, tMax); /* Appel du menu adapté au candidat */ //menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */
afficherCandChoix(aux, tMax); afficherCandChoix(aux, tMax);
sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */ sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */
} }

@ -119,6 +119,6 @@ bool videListe(ListeCand lCand);
ListeCand rechercherCandListe(ListeCand lCand, int numeroC, int *trouve); ListeCand rechercherCandListe(ListeCand lCand, int numeroC, int *trouve);
/* Fonctions globale, menus*/ /* Fonctions globale, menus*/
void globale(void); void globale2(void);
void menuCandidat(Candidat *tCand[], int tMax); void menuCandidat2(Candidat *tCand[], int tMax);
void clearpage(void); void clearpage(void);
Loading…
Cancel
Save