ajout des affichages + modifs des pb

master
Antoine PEREDERII 2 years ago
commit 7c82d17b15

@ -7,12 +7,13 @@
void global(void); void global(void);
/* Menus */ /* Menus */
void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, bool *phaseCandidatures, bool *phaseTraitement); void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, bool *phaseCandidatures, bool *phaseTraitement, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente);
void menuAdministrateur(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, bool *phaseCandidatures, bool *phaseTraitement); void menuAdministrateur(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, bool *phaseCandidatures, bool *phaseTraitement);
void menuUtilisateur(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats); void menuUtilisateur(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats);
void menuCandidat(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats); void menuCandidat(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats);
void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *nbIUT); void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *nbIUT);
void menuAffichage(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *nbIUT); void menuAffichage(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *nbIUT, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente);
/* Partie 1 */ /* Partie 1 */
/* Fichier */ /* Fichier */
@ -75,8 +76,9 @@ int inscription(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int nbVill
// int menuUtilisateur(ListeUtilisateurs listeUtilisateurs); // int menuUtilisateur(ListeUtilisateurs listeUtilisateurs);
// void global(void); // void global(void);
int plusGrand(Etudiant *tetudResp[], int nbCandResp); int plusPetit(Etudiant *tetudResp[], int nbCandResp);
void echanger(Etudiant *tetudResp[], int i, int j); void echanger(Etudiant *tetudResp[], int i, int j);
void triNote(Etudiant *tetudResp[], int nbCandResp); void triNote(Etudiant *tetudResp[], int nbCandResp);
void deptResp(VilleIUT *tiut[], int nbVilles, char respVille[], char respIUT[]); void deptResp(VilleIUT *tiut[], int nbVilles, char respVille[], char respIUT[]);
int chargementRespDept(Etudiant *tetud[], int nbCand, char respVille[], char respIUT[], Etudiant *tetudResp[]); int chargementRespDept(Etudiant *tetud[], int nbCand, char respVille[], char respIUT[], Etudiant *tetudResp[]);
void lancerAdmissions(Etudiant *tetudResp[], int nbCandResp, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente, char ville[], char dept[]);

@ -2,13 +2,13 @@
void global(void) void global(void)
{ {
int nbVilles, nbCandidats; int nbVilles, nbCandidats, nbAdmis = 0, nbAttente = 0;
bool phaseCandidatures = true, phaseTraitement = false; bool phaseCandidatures = true, phaseTraitement = false;
VilleIUT *tiut[100]; VilleIUT *tiut[100];
Etudiant *tetud[100]; Etudiant *tetud[100], *admis[100], *attente[100];
nbVilles = chargementVillesIUT(tiut); nbVilles = chargementVillesIUT(tiut);
nbCandidats = chargerCandidats(tetud); nbCandidats = chargerCandidats(tetud);
menu(tiut, &nbVilles, tetud, &nbCandidats, &phaseCandidatures, &phaseTraitement); menu(tiut, &nbVilles, tetud, &nbCandidats, &phaseCandidatures, &phaseTraitement, admis, &nbAdmis, attente, &nbAttente);
sauvegardeVillesIUT(tiut, nbVilles); sauvegardeVillesIUT(tiut, nbVilles);
sauvegarderCandidats(tetud, nbCandidats); sauvegarderCandidats(tetud, nbCandidats);
} }

@ -1,6 +1,6 @@
#include "SAE.h" #include "SAE.h"
void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, bool *phaseCandidatures, bool *phaseTraitement) void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, bool *phaseCandidatures, bool *phaseTraitement, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente)
{ {
int choix; int choix;
bool c = false; bool c = false;
@ -41,7 +41,7 @@ void menu(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandidats, boo
menuCandidat(tiut, nbIUT, tetud, nbCandidats); menuCandidat(tiut, nbIUT, tetud, nbCandidats);
break; break;
case 4: case 4:
menuResponsable(tetud, *nbCandidats, tiut, nbIUT); menuResponsable(tetud, *nbCandidats, tiut, nbIUT, tetudAdmis, nbEtudAdmis, tetudAttente, nbEtudAttente);
break; break;
case 9: case 9:
c = true; c = true;
@ -190,10 +190,16 @@ void menuCandidat(VilleIUT *tiut[], int *nbIUT, Etudiant *tetud[], int *nbCandid
} }
} }
void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *nbIUT) void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *nbIUT, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente)
{ {
int choix; int choix;
bool c = false; bool c = false;
Etudiant *tetudResp[100];
int nbCandidatsDept;
char respVille[30], respDept[30];
deptResp(tiut, *nbIUT, respVille, respDept);
nbCandidatsDept = chargementRespDept(tetud, *nbCandidats, respVille, respDept, tetudResp);
triNote(tetudResp, nbCandidatsDept);
//! Ajouter la moyenne et nommer deux liste pour admis et en attente //! Ajouter la moyenne et nommer deux liste pour admis et en attente
while (c == false) while (c == false)
@ -226,7 +232,7 @@ void menuResponsable(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int *
switch (choix) switch (choix)
{ {
case 1: case 1:
// lancerAdmission(tetudResp, *nbCandidats); lancerAdmissions(tetudResp, *nbCandidats, tetudAdmis, nbEtudAdmis, tetudAttente, nbEtudAttente, respVille, respDept);
break; break;
case 2: case 2:
menuAffichage(tetud, nbCandidats, tiut, nbIUT); menuAffichage(tetud, nbCandidats, tiut, nbIUT);

@ -224,11 +224,11 @@ int modifNbPlaces(int nbPlaces)
void triNote(Etudiant *tetudResp[], int nbCandResp) void triNote(Etudiant *tetudResp[], int nbCandResp)
{ {
int pge; int min;
while (nbCandResp > 1) while (nbCandResp > 1)
{ {
pge = plusGrand(tetudResp, nbCandResp); min = plusPetit(tetudResp, nbCandResp);
echanger(tetudResp, pge, nbCandResp - 1); echanger(tetudResp, min, nbCandResp - 1);
nbCandResp--; nbCandResp--;
} }
} }
@ -240,15 +240,46 @@ void echanger(Etudiant *tetudResp[], int i, int j)
tetudResp[j] = aux; tetudResp[j] = aux;
} }
int plusGrand(Etudiant *tetudResp[], int nbCandResp) int plusPetit(Etudiant *tetudResp[], int nbCandResp)
{ {
int pge = 0; int min = 0;
for (int i = 0; i < nbCandResp; i++) for (int i = 0; i < nbCandResp; i++)
{ {
if (tetudResp[i]->tabNotes[moy] > tetudResp[pge]->tabNotes[moy]) if (tetudResp[i]->tabNotes[4] < tetudResp[min]->tabNotes[4])
{ {
pge = i; min = i;
}
}
return min;
}
void lancerAdmissions(Etudiant *tetudResp[], int nbCandResp, Etudiant *tetudAdmis[], int *nbEtudAdmis, Etudiant *tetudAttente[], int *nbEtudAttente, char ville[], char dept[])
{
int placesMax, places = 0, pos;
float moyenneMin;
printf("Entrez la moyenne minimale requise :\n> ");
scanf("%f", &moyenneMin);
printf("Entrez le nombre de places :\n> ");
scanf("%d", &placesMax);
for (int i = 0; i < nbCandResp; i++)
{
pos = trouverPos(tetudResp[i]->lChoix, ville, dept);
if (tetudResp[i]->tabNotes[4] >= moyenneMin && places < placesMax)
{
setDecisionAdmission(tetudResp[i]->lChoix, pos, 1);
tetudAdmis[*nbEtudAdmis] = tetudResp[i];
*nbEtudAdmis++;
places++;
}
else if (tetudResp[i]->tabNotes[4] >= moyenneMin)
{
setDecisionAdmission(tetudResp[i]->lChoix, pos, 2);
tetudAdmis[*nbEtudAttente] = tetudResp[i];
*nbEtudAttente++;
}
else
{
setDecisionAdmission(tetudResp[i]->lChoix, pos, -1);
} }
} }
return pge;
} }

@ -1,4 +1,4 @@
2 3
1 1
Dufour Dufour
Albert Albert
@ -6,7 +6,7 @@ Albert
1 1
Clermont-Ferrand Clermont-Ferrand
Informatique Informatique
2 0
0 0
2 2
Michel Michel
@ -21,3 +21,12 @@ Grenoble
Informatique Informatique
0 0
0 0
3
Chabanon
Kyllian
20.00 20.00 20.00 20.00
1
Clermont-Ferrand
Informatique
0
0

@ -139,3 +139,23 @@ char *getVilleChoix(ListeChoix lc, int pos)
} }
return lc->choix.ville; return lc->choix.ville;
} }
void setDecisionAdmission(ListeChoix lc, int pos, int val)
{
for (int i = 0; i < pos; i++)
{
lc = lc->suiv;
}
lc->choix.decisionAdmission = val;
}
int trouverPos(ListeChoix lc, char ville[], char dept[])
{
for (int i = 0; i < longueurChoix(lc); i++)
{
if (strcmp(lc->choix.ville, ville) == 0 && strcmp(lc->choix.departement, dept) == 0)
{
return i;
}
}
}

@ -84,3 +84,5 @@ int longueurChoix(ListeChoix lc);
void afficherCandidatsChoix(Choix choix); void afficherCandidatsChoix(Choix choix);
char *getDeptChoix(ListeChoix lc, int pos); char *getDeptChoix(ListeChoix lc, int pos);
char *getVilleChoix(ListeChoix lc, int pos); char *getVilleChoix(ListeChoix lc, int pos);
int trouverPos(ListeChoix lc, char ville[], char dept[]);
void setDecisionAdmission(ListeChoix lc, int pos, int val);
Loading…
Cancel
Save