diff --git a/Commun.c b/Commun.c index d58195d..d952b8d 100644 --- a/Commun.c +++ b/Commun.c @@ -853,6 +853,7 @@ void enregistrement(VilleIUT *tiut[],int tLog) /* Permet l'enregistrement du tab // ########################################################################################### // ########################################################################################### + /************************************** Fonctions de Chargement ********************************************/ /****************************************** 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 *********************************************/ /************************************************************************************************************/ /************************************************************************************************************/ @@ -1070,6 +1092,13 @@ int plusGrandCand(Candidat *tCand[], int tMax) /* Fonction permettant de trouver int maxi = 0, 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) { 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; 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 */ } -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; system("clear"); diff --git a/J2sae.c b/J2sae.c index be70fd0..4ad4f2e 100755 --- a/J2sae.c +++ b/J2sae.c @@ -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 *********************************************/ /************************************************************************************************************/ /************************************************************************************************************/ @@ -217,6 +238,13 @@ int plusGrandCand(Candidat *tCand[], int tMax) /* Fonction permettant de trouver int maxi = 0, 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) { maxi = i; @@ -845,7 +873,7 @@ void globale2(void) /* Permet de gérer l'exécution du programme */ tCand[i] = tCand[mini]; tCand[mini] = temp; } - //menuCandidat2(tCand, tMax); /* Appel du menu adapté au candidat */ + //menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */ afficherCandChoix(aux, tMax); sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */ } diff --git a/J2sae.h b/J2sae.h index 0526445..7a2b022 100755 --- a/J2sae.h +++ b/J2sae.h @@ -119,6 +119,6 @@ bool videListe(ListeCand lCand); ListeCand rechercherCandListe(ListeCand lCand, int numeroC, int *trouve); /* Fonctions globale, menus*/ -void globale(void); -void menuCandidat(Candidat *tCand[], int tMax); +void globale2(void); +void menuCandidat2(Candidat *tCand[], int tMax); void clearpage(void); \ No newline at end of file