You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
282 lines
8.1 KiB
282 lines
8.1 KiB
#include "SAE.h"
|
|
|
|
void deptResp(VilleIUT *tiut[], int nbVilles, char respVille[], char respIUT[])
|
|
{
|
|
char nom[30];
|
|
printf("Entrez votre nom et votre prénom :\n> ");
|
|
fgets(nom, 30, stdin);
|
|
nom[strlen(nom) - 1] = '\0';
|
|
for (int i = 0; i < nbVilles; i++)
|
|
{
|
|
for (int n = 0; n < longueur(tiut[i]->ldept); n++)
|
|
{
|
|
if (strcmp(getResp(tiut[i]->ldept, n), nom) == 0)
|
|
{
|
|
strcpy(respVille, tiut[i]->ville);
|
|
strcpy(respIUT, getDept(tiut[i]->ldept, n));
|
|
return;
|
|
}
|
|
}
|
|
//! Rechercher si existe
|
|
}
|
|
}
|
|
|
|
int chargementRespDept(Etudiant *tetud[], int nbCand, char respVille[], char respIUT[], Etudiant *tetudResp[])
|
|
{
|
|
int nb = 0;
|
|
for (int i = 0; i < nbCand; i++)
|
|
{
|
|
for (int n = 0; n < tetud[i]->nbChoix; n++)
|
|
{
|
|
if (strcmp(getDeptChoix(tetud[i]->lChoix, n), respIUT) == 0 && strcmp(getVilleChoix(tetud[i]->lChoix, n), respVille) == 0)
|
|
{
|
|
tetudResp[nb] = tetud[i];
|
|
nb++;
|
|
}
|
|
}
|
|
}
|
|
return nb;
|
|
}
|
|
|
|
|
|
|
|
// Etudiant moyenneCandidat(Etudiant mEtudiant)
|
|
// {
|
|
// float moyenne = 0;
|
|
// for (int i = 0; i < 4; i++)
|
|
// {
|
|
// moyenne += mEtudiant.tabNotes[i];
|
|
// }
|
|
// moyenne /= 4;
|
|
// mEtudiant.tabNotes[moy] = moyenne;
|
|
// return mEtudiant;
|
|
// }
|
|
|
|
// Etudiant *moyenneCandidats(Etudiant *tetud[], int nbCandidats)
|
|
// {
|
|
// for (int i = 0; i < nbCandidats; i++)
|
|
// {
|
|
// *tetud[i] = moyenneCandidat(*tetud[i]);
|
|
// }
|
|
// return *tetud;
|
|
// }
|
|
|
|
|
|
Etudiant modifStatueCandidat(Etudiant *tetud[], int nbCandidats, float noteMin[], VilleIUT *tiut[], int nbIUT, char respVille[30], char respDept[30]) //! tableau des admis + compteur admis
|
|
{
|
|
int posIUT, posDept, nbPlaces;
|
|
bool trouve;
|
|
posIUT = rechercheVille(tiut, nbIUT, respVille, &trouve);
|
|
if (trouve == false)
|
|
{
|
|
printf("L'IUT de ce responsable n'existe pas. Veuillez réessayer en changeant de responsable.\n");
|
|
return;
|
|
}
|
|
posDept = rechercheDept(tiut[posIUT]->ldept, respDept, &trouve);
|
|
if (trouve == false)
|
|
{
|
|
printf("Le departement de ce responsable n'existe pas. Veuillez réessayer en changeant de responsable.\n");
|
|
return;
|
|
}
|
|
for (int i = 0; i < nbCandidats; i++)
|
|
{
|
|
if (tetud[i]->tabNotes[maths] >= noteMin[maths] && tetud[i]->tabNotes[francais] >= noteMin[francais] && tetud[i]->tabNotes[anglais] >= noteMin[anglais] && tetud[i]->tabNotes[spe] >= noteMin[spe] && tetud[i]->tabNotes[moy] >= noteMin[moy] && nbCandidatsAdmis(tetud, nbCandidats) <= getNbP(tiut[posIUT]->ldept, posDept))
|
|
{
|
|
tetud[i]->lChoix->choix.decisionAdmission = 1;
|
|
}
|
|
else if(tetud[i]->tabNotes[maths] >= noteMin[maths] && tetud[i]->tabNotes[francais] >= noteMin[francais] && tetud[i]->tabNotes[anglais] >= noteMin[anglais] && tetud[i]->tabNotes[spe] >= noteMin[spe] && tetud[i]->tabNotes[moy] >= noteMin[moy] && nbCandidatsAdmis(tetud, nbCandidats) > getNbP(tiut[posIUT]->ldept, posDept))
|
|
{
|
|
tetud[i]->lChoix->choix.decisionAdmission = 2;
|
|
}
|
|
else
|
|
{
|
|
tetud[i]->lChoix->choix.decisionAdmission = -1;
|
|
}
|
|
}
|
|
return **tetud;
|
|
}
|
|
|
|
int statueCandidat(Etudiant *tetud[], int nbCandidats, Etudiant *tetudAdmis[], Etudiant *tetudAttente[], int nbEtudAdmis, int nbEtudAttente)
|
|
{
|
|
int i;
|
|
for (i = 0; i < nbCandidats; i++)
|
|
{
|
|
if (tetud[i]->lChoix->choix.decisionAdmission == 1)
|
|
{
|
|
tetudAdmis[nbEtudAdmis] = tetud[i];
|
|
nbEtudAdmis++;
|
|
}
|
|
else if (tetud[i]->lChoix->choix.decisionAdmission == 2)
|
|
{
|
|
tetudAttente[nbEtudAttente] = tetud[i];
|
|
nbEtudAttente++;
|
|
}
|
|
}
|
|
}
|
|
|
|
Etudiant ValidationCandidature()
|
|
{
|
|
int i;
|
|
char choix[30];
|
|
printf("Quel voeu souhaitez-vous valider ?\n")
|
|
scanf("%s", &choix);
|
|
for (i = 0; i < nbCandidats; i++)
|
|
{
|
|
if (tetud[i]->lChoix->choix.decisionAdmission == 1)
|
|
{
|
|
tetud[i]->lChoix->choix.decisionAdmission = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
int nbCandidatsAdmis(Etudiant *tetud[], int nbCandidats)
|
|
{
|
|
int nbAdmis = 0;
|
|
for (int i = 0; i < nbCandidats; i++)
|
|
{
|
|
if (tetud[i]->lChoix->choix.decisionAdmission == 1)
|
|
{
|
|
nbAdmis++;
|
|
}
|
|
}
|
|
return nbAdmis;
|
|
}
|
|
|
|
int nbCandidatsRefuses(Etudiant *tetud[], int nbCandidats)
|
|
{
|
|
int nbRefuses = 0;
|
|
for (int i = 0; i < nbCandidats; i++)
|
|
{
|
|
if (tetud[i]->lChoix->choix.decisionAdmission == -1)
|
|
{
|
|
nbRefuses++;
|
|
}
|
|
}
|
|
return nbRefuses;
|
|
}
|
|
|
|
int nbCandidatsAttente(Etudiant *tetud[], int nbCandidats)
|
|
{
|
|
int nbAttente = 0;
|
|
for (int i = 0; i < nbCandidats; i++)
|
|
{
|
|
if (tetud[i]->lChoix->choix.decisionAdmission == 2)
|
|
{
|
|
nbAttente++;
|
|
}
|
|
}
|
|
return nbAttente;
|
|
}
|
|
|
|
float modifNoteMin(float noteMin[])
|
|
{
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
printf("Entrez la note minimale pour la matiere %s (0/20, -1 pour sortir) : ", i + 1); // afficher le nom de la matiere du enum
|
|
scanf("%f", ¬eMin[i]);
|
|
while (noteMin[i] < 0 || noteMin[i] > 20)
|
|
{
|
|
scanf("%f", ¬eMin[i]);
|
|
if (noteMin[i] == -1)
|
|
{
|
|
break;
|
|
}
|
|
printf("La note doit être comprise entre 0 et 20 !\n");
|
|
}
|
|
}
|
|
return *noteMin;
|
|
}
|
|
|
|
void modificationNbPDeptResp(VilleIUT *tiut[], int nbIUT, char respVille[30], char respDept[30])
|
|
{
|
|
int posIUT, posDept, nbPlaces;
|
|
bool trouve;
|
|
posIUT = rechercheVille(tiut, nbIUT, respVille, &trouve);
|
|
if (trouve == false)
|
|
{
|
|
printf("L'IUT de ce responsable n'existe pas. Veuillez réessayer en changeant de responsable.\n");
|
|
return;
|
|
}
|
|
posDept = rechercheDept(tiut[posIUT]->ldept, respDept, &trouve);
|
|
if (trouve == false)
|
|
{
|
|
printf("Le departement de ce responsable n'existe pas. Veuillez réessayer en changeant de responsable.\n");
|
|
return;
|
|
}
|
|
printf("Il y a actuellement %d places dans ce département. Entrez le nouveau nombre de places :\n> ", getNbP(tiut[posIUT]->ldept, posDept));
|
|
scanf("%d", &nbPlaces);
|
|
setNbP(tiut[posIUT]->ldept, posDept, nbPlaces);
|
|
printf("Le nombre de places est bien passé à %d.\n", getNbP(tiut[posIUT]->ldept, posDept));
|
|
}
|
|
|
|
int modifNbPlaces(int nbPlaces)
|
|
{
|
|
printf("Entrez le nombre de places disponibles : ");
|
|
scanf("%d", &nbPlaces);
|
|
return nbPlaces;
|
|
}
|
|
|
|
void triNote(Etudiant *tetudResp[], int nbCandResp)
|
|
{
|
|
int min;
|
|
while (nbCandResp > 1)
|
|
{
|
|
min = plusPetit(tetudResp, nbCandResp);
|
|
echanger(tetudResp, min, nbCandResp - 1);
|
|
nbCandResp--;
|
|
}
|
|
}
|
|
|
|
void echanger(Etudiant *tetudResp[], int i, int j)
|
|
{
|
|
Etudiant *aux;
|
|
aux = tetudResp[i];
|
|
tetudResp[i] = tetudResp[j];
|
|
tetudResp[j] = aux;
|
|
}
|
|
|
|
int plusPetit(Etudiant *tetudResp[], int nbCandResp)
|
|
{
|
|
int min = 0;
|
|
for (int i = 0; i < nbCandResp; i++)
|
|
{
|
|
if (tetudResp[i]->tabNotes[4] < tetudResp[min]->tabNotes[4])
|
|
{
|
|
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 && places >= placesMax)
|
|
{
|
|
setDecisionAdmission(tetudResp[i]->lChoix, pos, 2);
|
|
tetudAttente[*nbEtudAttente] = tetudResp[i];
|
|
*nbEtudAttente++;
|
|
}
|
|
else
|
|
{
|
|
setDecisionAdmission(tetudResp[i]->lChoix, pos, -1);
|
|
}
|
|
}
|
|
}
|
|
|