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.
209 lines
5.7 KiB
209 lines
5.7 KiB
#include "SAE.h"
|
|
|
|
Departement lireDept(FILE *flot, ListeDepartement dpt)
|
|
{
|
|
fscanf(flot, "%s\n%d\n%d\n", dpt.departement, &dpt.decisionAdmission, &dpt.decisionCandidat);
|
|
return dpt;
|
|
}
|
|
|
|
void afficheDept(Departement dpt)
|
|
{
|
|
printf("\t%s\t%d\t%d", dpt.departement, dpt.decisionAdmission, dpt.decisionCandidat);
|
|
}
|
|
|
|
Admission lireCandidat(FILE *flot, ListeAdmission la, char dptResAdmis[])
|
|
{
|
|
int i = 0;
|
|
fscanf(flot, "%d\n", &la->v.num);
|
|
fgets(la->v.nom, 22, flot);
|
|
la->v.nom[strlen(la->v.nom) - 1] = '\0';
|
|
fgets(la->v.prenom, 22, flot);
|
|
la->v.prenom[strlen(la->v.prenom) - 1] = '\0';
|
|
fscanf(flot, "%d\t%d\t%d\t%d\n%d\n%s\n", &la->v.tabMatiere[0], &la->v.tabMatiere[1], &la->v.tabMatiere[2], &la->v.tabMatiere[3], &la->v.nbChoix, la->v.ville);
|
|
if (la->v.nbChoix == 0)
|
|
{
|
|
listenouv();
|
|
return la->v;
|
|
}
|
|
ajouterDpt(la->v.ldept, lireDept(flot, la->v.ldept));
|
|
while (!feof(flot) && i < la->v.nbChoix)
|
|
{
|
|
if (strcmp(la->v.ldept, dptResAdmi) == 0)
|
|
{
|
|
la->v.ldept = insererDpt(la->v.ldept, la->v.ldept->v.departement);
|
|
}
|
|
ajouterDpt(la->v.ldept, lireDept(flot, la->v.ldept));
|
|
i++;
|
|
}
|
|
return la->v;
|
|
}
|
|
|
|
void afficherCandidats(ListeAdmission la)
|
|
{
|
|
int i;
|
|
printf("%d\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t%d\t%d", la->v.num, la->v.nom, la->v.prenom, la->v.tabMatiere[0], la->v.tabMatiere[1], la->v.tabMatiere[2], la->v.tabMatiere[3], la->v.nbChoix, la->v.ville);
|
|
for (i = 0; i < la->v.nbChoix; i++)
|
|
{
|
|
afficherDpt(la->v.ldept->v);
|
|
la->v.ldept = la->v.ldept->suiv;
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
// Regarder si le nombre de choix est = à 0 Que se passe-t-il ?
|
|
|
|
ListeAdmission chargerCandidats(char *ficAdmission, char dptResAdmi[30], ListeAdmission la)
|
|
{
|
|
FILE *flot;
|
|
listenouv();
|
|
flot = fopen(ficAdmission, "r");
|
|
if (flot == NULL)
|
|
{
|
|
printf("Erreur d'ouverture du fichier !\n");
|
|
exit(1);
|
|
}
|
|
insererAdm(la, lireCandidat(flot, la, dptResAdmi));
|
|
while (!feof(flot))
|
|
{
|
|
la = insererCand(la, la->v);
|
|
la->v = lireCandidat(flot, la, dptResAdmi);
|
|
}
|
|
fclose(flot);
|
|
return la;
|
|
}
|
|
|
|
void sauvegarderCandidats(ListeAdmission la, char dptResAdmi[30])
|
|
{
|
|
FILE *flot;
|
|
flot = fopen("admissionInfo.txt", "w");
|
|
if (flot == NULL)
|
|
{
|
|
printf("Erreur d'ouverture du fichier !\n");
|
|
exit(1);
|
|
}
|
|
while (!videAdm(la))
|
|
{
|
|
fprintf(flot, "%d\n%s\n%s\n%d\t%d\t%d\t%d\n%d\n%s\n", la->v.num, la->v.nom, la->v.prenom, la->v.tabMatiere[0], la->v.tabMatiere[1], la->v.tabMatiere[2], la->v.tabMatiere[3], la->v.nbChoix, la->v.ville);
|
|
while (!videDpt(la->v.ldept))
|
|
{
|
|
fprintf(flot, "%s\n%d\n%d\n", la->v.ldept->v.departement, la->v.ldept->v.decisionAdmission, la->v.ldept->v.decisionCandidat);
|
|
la->v.ldept = la->v.ldept->suiv;
|
|
}
|
|
la = la->suiv;
|
|
}
|
|
fclose(flot);
|
|
}
|
|
|
|
void afficherCandidatsAdmis(ListeAdmission la)
|
|
{
|
|
while (!videCand(la->v.ldept))
|
|
{
|
|
if (la->v.ldept->v.decisionAdmission == 1)
|
|
{
|
|
afficherCandidats(la);
|
|
}
|
|
la->v.ldept = la->v.ldept->suiv;
|
|
}
|
|
}
|
|
|
|
void afficherCandidatsNonAdmis(ListeAdmission la)
|
|
{
|
|
while (!videCand(la->v.ldept))
|
|
{
|
|
if (la->v.ldept->v.decisionAdmission == 0)
|
|
{
|
|
afficherCandidats(la);
|
|
}
|
|
}
|
|
}
|
|
|
|
void afficherCandidatsAttente(ListeAdmission la)
|
|
{
|
|
while (!videCand(la->v.ldept))
|
|
{
|
|
if (la->v.ldept->v.decisionAdmission == 2)
|
|
{
|
|
afficherCandidats(la);
|
|
}
|
|
la = la->suiv;
|
|
}
|
|
}
|
|
|
|
void afficherCandidatsDpt(ListeAdmission la)
|
|
{
|
|
while (!videAdm(la->v.ldept))
|
|
{
|
|
afficherCandidats(la);
|
|
la = la->suiv;
|
|
}
|
|
}
|
|
|
|
ListeAdmission MoyenneCandidats(ListeAdmission la)
|
|
{
|
|
while (!videAdm(la))
|
|
{
|
|
la->v.tabMatiere[4] = (la->v.tabMatiere[0] + la->v.tabMatiere[1] + la->v.tabMatiere[2] + la->v.tabMatiere[3]) / 4;
|
|
la = la->suiv;
|
|
}
|
|
return la;
|
|
}
|
|
|
|
// Comment definir la note sur 20 mise lors de l'etude du dossier ?
|
|
// Ajouter une variable dans la structure Admission ?
|
|
// Ou mettre la liste et la note dans un tableau ?
|
|
// Après examen de chaque dossier de candidature,
|
|
// le jury doit regarder ou la note peut etre calculée automatiquement ?
|
|
|
|
int modifNoteMinAdmis()
|
|
{
|
|
int noteMaths, noteFrançais, noteAnglais, noteSpe;
|
|
printf("Entrez la nouvelle note minimale d'admission en maths (-1 pour quitter) : ");
|
|
while (noteMaths < 0 || noteMaths > 20)
|
|
{
|
|
scanf("%d", ¬eMaths);
|
|
if (noteMaths == -1)
|
|
{
|
|
break;
|
|
}
|
|
printf("La note doit être comprise entre 0 et 20 !\n");
|
|
}
|
|
printf("Entrez la nouvelle note minimale d'admission en français (-1 pour quitter) : ");
|
|
while (noteFrançais < 0 || noteFrançais > 20)
|
|
{
|
|
scanf("%d", ¬eFrançais);
|
|
if (noteFrançais == -1)
|
|
{
|
|
break;
|
|
}
|
|
printf("La note doit être comprise entre 0 et 20 !\n");
|
|
}
|
|
printf("Entrez la nouvelle note minimale d'admission en anglais (-1 pour quitter) : ");
|
|
while (noteAnglais < 0 || noteAnglais > 20)
|
|
{
|
|
scanf("%d", ¬eAnglais);
|
|
if (noteAnglais == -1)
|
|
{
|
|
break;
|
|
}
|
|
printf("La note doit être comprise entre 0 et 20 !\n");
|
|
}
|
|
printf("Entrez la nouvelle note minimale d'admission en spécialité (-1 pour quitter) : ");
|
|
while (noteSpe < 0 || noteSpe > 20)
|
|
{
|
|
scanf("%d", ¬eSpe);
|
|
if (noteSpe == -1)
|
|
{
|
|
break;
|
|
}
|
|
printf("La note doit être comprise entre 0 et 20 !\n");
|
|
}
|
|
}
|
|
|
|
int modifNbAdmisMax()
|
|
{
|
|
int nbAdmisMax;
|
|
printf("Entrez le nouveau nombre d'admis maximum : ");
|
|
scanf("%d", &nbAdmisMax);
|
|
return nbAdmisMax;
|
|
}
|