parent
8095918788
commit
4ea3feafd7
@ -1,208 +1,226 @@
|
||||
#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;
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
// 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");
|
||||
}
|
||||
// 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)
|
||||
int chargerCandidats(MaillonEtudiant *tetud[])
|
||||
{
|
||||
FILE *flot;
|
||||
listenouv();
|
||||
flot = fopen(ficAdmission, "r");
|
||||
if (flot == NULL)
|
||||
FILE *file;
|
||||
file = fopen("resultats.txt", "r");
|
||||
int nbCandidats, i = 0;
|
||||
Choix choix;
|
||||
if (file == NULL)
|
||||
{
|
||||
printf("Erreur d'ouverture du fichier !\n");
|
||||
exit(1);
|
||||
}
|
||||
insererAdm(la, lireCandidat(flot, la, dptResAdmi));
|
||||
while (!feof(flot))
|
||||
fscanf(file, "%d", &nbCandidats);
|
||||
while(!feof(file))
|
||||
{
|
||||
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))
|
||||
tetud[i] = (MaillonEtudiant*)malloc(sizeof(MaillonEtudiant));
|
||||
if (tetud[i]==NULL)
|
||||
{
|
||||
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;
|
||||
printf("Erreur malloc");
|
||||
exit(2);
|
||||
}
|
||||
la = la->suiv;
|
||||
}
|
||||
fclose(flot);
|
||||
}
|
||||
|
||||
void afficherCandidatsAdmis(ListeAdmission la)
|
||||
{
|
||||
while (!videCand(la->v.ldept))
|
||||
{
|
||||
if (la->v.ldept->v.decisionAdmission == 1)
|
||||
fscanf("%d%s", tetud[i]->num, tetud[i]->nom);
|
||||
fgets(tetud[i]->prenom, 22, stdin);
|
||||
tetud[i]->prenom[strlen(tetud[i]->prenom - 1)] = '\0';
|
||||
for (int note = 0; note < 5; note++)
|
||||
{
|
||||
afficherCandidats(la);
|
||||
fscanf(file, "%f", tetud[i]->tabMatiere[note]);
|
||||
}
|
||||
la->v.ldept = la->v.ldept->suiv;
|
||||
}
|
||||
}
|
||||
|
||||
void afficherCandidatsNonAdmis(ListeAdmission la)
|
||||
{
|
||||
while (!videCand(la->v.ldept))
|
||||
{
|
||||
if (la->v.ldept->v.decisionAdmission == 0)
|
||||
fscanf(file, "%d", tetud[i]->nbChoix);
|
||||
tetud[i]->lChoix = listenouvChoix();
|
||||
for (int n = 0; n < tetud[i]->nbChoix; n++)
|
||||
{
|
||||
afficherCandidats(la);
|
||||
fscanf(file, "%s%s%d%d", choix.ville, choix.departement, &choix.decisionAdmission, &choix.decisionCandidat);
|
||||
tetud[i]->lChoix = insererChoix(tetud[i]->lChoix, choix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
// }
|
||||
|
||||
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;
|
||||
}
|
||||
// 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;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 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 ?
|
||||
// void afficherCandidatsNonAdmis(ListeAdmission la)
|
||||
// {
|
||||
// while (!videCand(la->v.ldept))
|
||||
// {
|
||||
// if (la->v.ldept->v.decisionAdmission == 0)
|
||||
// {
|
||||
// afficherCandidats(la);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
// void afficherCandidatsAttente(ListeAdmission la)
|
||||
// {
|
||||
// while (!videCand(la->v.ldept))
|
||||
// {
|
||||
// if (la->v.ldept->v.decisionAdmission == 2)
|
||||
// {
|
||||
// afficherCandidats(la);
|
||||
// }
|
||||
// la = la->suiv;
|
||||
// }
|
||||
// }
|
||||
|
||||
int modifNbAdmisMax()
|
||||
{
|
||||
int nbAdmisMax;
|
||||
printf("Entrez le nouveau nombre d'admis maximum : ");
|
||||
scanf("%d", &nbAdmisMax);
|
||||
return nbAdmisMax;
|
||||
}
|
||||
// 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;
|
||||
// }
|
||||
|
Loading…
Reference in new issue