Mise a jour mineure

master
Johnny RATTON 2 years ago
parent 8d8b4fe48c
commit f3dfc44a4b

@ -857,6 +857,10 @@ void enregistrement(VilleIUT *tiut[],int tLog) /* Permet l'enregistrement du tab
/****************************************** Et de sauvegarde*************************************************/
/************************************************************************************************************/
/************************************** Fonctions de Chargement ********************************************/
/****************************************** Et de sauvegarde*************************************************/
/************************************************************************************************************/
Candidat ** chargementCandidats(int *tMax) /* Permet de charger le contenu du fichier Candidats.don dans un tableau de pointeur vers */
{ /* des structures Candidats qui contiennent un tableau de pointeurs vers des structures choix*/
FILE *flot; /* La fonction renvoie ensuite le tableau de Candidats si tout se passe bien */
@ -976,9 +980,9 @@ void afficherChoix(Choix *c) /* Fonction permettant d'afficher les informations
void afficherCandidat(Candidat *c) /* Fonction permettant d'afficher les informations d'un candidat donné en paramètre */
{
printf("|---------------------------------------------------------------------------------------------------------|\n");
printf("| %-4d | %-32s | %-32s | %2.2f | %2.2f | %2.2f | %2.2f |\n", c->numeroC, c->nom, c->prenom, c->notes[0], c->notes[1], c->notes[2], c->notes[3]);
printf("|---------------------------------------------------------------------------------------------------------|\n");
printf("|-------------------------------------------------------------------------------------------------------------------|\n");
printf("| %-4d | %-32s | %-32s | %2.2f | %2.2f | %2.2f | %2.2f | %2.2f |\n", c->numeroC, c->nom, c->prenom, c->notes[0], c->notes[1], c->notes[2], c->notes[3], c->moyenne);
printf("|-------------------------------------------------------------------------------------------------------------------|\n");
}
void afficherCandChoix(Candidat *tCand[],int tMax) /* Fonction permettant d'afficher tous les candidats du tableau tCand ainsi que tous leurs choix */
@ -986,12 +990,12 @@ void afficherCandChoix(Candidat *tCand[],int tMax) /* Fonction permettant d'aff
int i, j;
for(i = 0; i < tMax; i++)
{
printf("_____________________________________________________________________________________________________________\n");
printf("| Candidat |\n");
printf("_____________________________________________________________________________________________________________________\n");
printf("| Candidat |\n");
afficherCandidat(tCand[i]);
printf("\n");
printf("_______________________________________________________________________________\n");
printf("| Choix |\n");
printf("_________________________________________________________________________________\n");
printf("| Choix |\n");
for(j = 0; j < tCand[i]->nombreChoix; j++)
{
afficherChoix(tCand[i]->tChoix[j]);
@ -1209,7 +1213,7 @@ Choix ** supprimerChoix(Choix *tChoix[], int *nombreChoix) /* Fonction permettan
}
void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant de mettre à jour la décision d'un candidat concernant un de ses choix */
int miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant de mettre à jour la décision d'un candidat concernant un de ses choix */
{
int pos, trouve, saisie;
char ville[31], dep[31];
@ -1223,7 +1227,7 @@ void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant
if(trouve == 0)
{
printf("Erreur, ce choix ne figure pas dans votre liste\n");
return;
return -2;
}
system("clear");
if(tChoix[pos]->decisionCand == 0)
@ -1242,26 +1246,26 @@ void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant
if(saisie == 1)
{
tChoix[pos]->decisionCand = 1;
return;
return 1;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = -1;
return;
return -1;
}
if(saisie == 3)
{
return;
return 0;
}
}
}
void miseAJourChoixResp(Choix *tChoix[], int pos) /* Fontcion permettant de mettre à jour la décision d'un responsable d'admission concernant un candidat */
/*void miseAJourChoixResp(Choix *tChoix[], int pos) Fontcion permettant de mettre à jour la décision d'un responsable d'admission concernant un candidat
{
int saisie;
system("clear");
if(tChoix[pos]->decisionCand == 0) /* Affichage d'un menu adapté pour chaque cas ; le candidat peut choisir entre deux option ou bien ne rien faire */
if(tChoix[pos]->decisionCand == 0) Affichage d'un menu adapté pour chaque cas ; le candidat peut choisir entre deux option ou bien ne rien faire
{
printf("Votre décision est actuellement en attente\n\n");
printf("|---------------------------------------|\n");
@ -1323,7 +1327,7 @@ void miseAJourChoixResp(Choix *tChoix[], int pos) /* Fontcion permettant de mett
return;
}
}
}
}*/
Candidat ** creerCandidat(Candidat *tCand[], int *tMax)
@ -1497,11 +1501,6 @@ FileCand supt(FileCand f)
return f;
}
FileCand supCand(FileCand f, int numeroC)
{
}
Candidat * tete(FileCand f)
{
if(vide(f))
@ -1559,6 +1558,100 @@ void afficher(FileCand f)
printf("\n");
}
/************************************* Fonctions de liste d'admission ***************************************/
/************************************************************************************************************/
/************************************************************************************************************/
ListeDept listeDeptNouv(void) /*Permet de créer un liste vide puis la retourne à la fonction appelante.*/
{
ListeDept lDept;
lDept = NULL;
return lDept;
}
ListeDept insererEntete(ListeDept lDept,Departement d) /*Permet d'insérer un MaillonDept en début d'une liste passée en paramètre puis renvoie cette même liste*/
{
MaillonDept *m; /* Création d'un pointeur vers une structure MaillonDept */
m = (MaillonDept *)malloc(sizeof(MaillonDept)); /* Allocation d'un espace mémoire pour le nouveau maillon */
if(m == NULL)
{
printf("Problème d'allocation mémoire lors de l'insertion\n"); /* Message d'erreur en cas de problème de malloc */
exit(1);
}
m->d = d; /* Affecte le département passé en paramètre à l'attribut d du nouveau maillon */
m->suiv = lDept;
return m;
}
ListeDept insererDept(ListeDept lDept, Departement d) /* Permet d'insérer un maillon dans une liste donnée en paramètre dans l'ordre alpĥabétique/croissant et retourne cette liste */
{
if(lDept == NULL) /* Si la liste est vide, insère le nouveau maillon en tête */
{
return insererEntete(lDept,d);
}
if(strcmp(d.dept, lDept->d.dept) < 0) /* Si le nom du département est inférieur à celui de la liste testé, le maillon est inséré en tête*/
{
return insererEntete(lDept,d);
}
if(strcmp(d.dept,lDept->d.dept) == 0) /* Si le maillon existe déjà, retourne la liste sans changement */
{
printf("Département déjà présent dans cet IUT\n");
return lDept;
}
lDept->suiv = insererDept(lDept->suiv,d); /* Si aucun cas précédent n'est respecté, recommence avec le maillon suivant de la liste */
return lDept;
}
ListeDept supprimerEntete(ListeDept lDept) /* Permet de supprimer un maillon en tête de la liste donnée en paramètre et retourne cette liste */
{
ListeDept aux;
if(lDept == NULL) /* Si la liste est vide, quitte le programme car cela provoquerait une erreur */
{
printf("Opération interdite\n");
exit(1);
}
aux = lDept; /* On affecte l'adresse de la liste actuelle à une variable temporaire */
lDept = lDept->suiv; /* On supprime le maillon */
free(aux); /* On libère l'espace mémoire du maillon supprimer*/
return lDept;
}
ListeDept supprimerDept(ListeDept lDept, char *dep) /* Permet de supprimer un maillon d'une liste lDept passée en paramètre à partir de son attribut nom de département (dept) et retourne cette liste */
{
if(lDept == NULL) /* La liste est vide, on la retourne sans changements */
{
return lDept;
}
if(strcmp(dep, lDept->d.dept) < 0) /* Le maillon à supprimer n'existe pas, on retourne la liste sans changement */
{
return lDept;
}
if(strcmp(dep,lDept->d.dept) == 0) /* Le maillon à supprimer est trouvé, on le supprime */
{
return supprimerEntete(lDept);
}
lDept->suiv = supprimerDept(lDept->suiv,dep); /* Aucune des conditions précédentes n'a été respectée, on recommence avec le maillon suivant */
return lDept;
}
int longueur(ListeDept lDept) /* Permet d'obtenir la longueur d'une liste passée en paramètre et retourne le nombre de maillons */
{
int compt = 0; /* On déclare un compteur pour compter le nombre de maillons */
while(lDept != NULL) /* Tant que la liste n'est pas vide, on incrémente le compteur de 1 et on passe au maillon suivant */
{
compt = compt + 1;
lDept = lDept->suiv;
}
return compt;
}
bool vide(ListeDept lDept) /* Permet de savoir si une liste est vide et retourne un booléen */
{
if(lDept == NULL)
return true;
return false;
}
/********************************** Fonction globale et menus ***********************************************/
/************************************************************************************************************/
@ -1566,8 +1659,8 @@ void afficher(FileCand f)
void globale(void) /* Permet de gérer l'exécution du programme */
{
int tMax, pos, trouve, i, j;
Candidat **tCand, c **aux; /* Initialisation du tableau de candidats */
int tMax, pos, trouve, i = 0, j, mini = i;
Candidat **tCand, c, **aux, *temp; /* Initialisation du tableau de candidats */
tCand = chargementCandidats(&tMax); /* Remplissage du tableau par chargement */
triCandidats(tCand, tMax); /* Tri du tableau */
for(i = 0; i < tMax; i++) /* Tri du tableau choix pour chaque candidat */
@ -1575,9 +1668,21 @@ void globale(void) /* Permet de gérer l'exécution du programme */
triChoix(tCand[i]->tChoix, tCand[i]->nombreChoix);
}
aux = tCand;
while(aux != )
for(i = 0; i < tMax - 1; i++)
{
for(j = i + 1; j < tMax; j++)
{
if(tCand[j]->moyenne < tCand[i]->moyenne)
{
mini = j;
}
}
temp = tCand[i];
tCand[i] = tCand[mini];
tCand[mini] = temp;
}
//menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */
afficherCandChoix(tCand, tMax);
afficherCandChoix(aux, tMax);
sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */
}
@ -1646,12 +1751,3 @@ void menuCandidat(Candidat *tCand[], int tMax) /* Fonction affichant un menu ada
printf("\n");
}
}
void clearpage(void) /* Permet de demander à l'utilisateur pour continuer à la suite d'une action et efface le contenu affiché à l'écran */
{
char entre;
printf("\n");
printf("Appuyez sur la touche [ENTREE] pour continuer");
scanf("%c", &entre);
system("clear");
}

@ -114,7 +114,7 @@ typedef struct maillonCand
{
Candidat *c;
struct maillonCand *suiv;
} MaillonCandidat, *ListeCand;
} MaillonCandidat;
typedef struct
{
@ -160,8 +160,8 @@ int rechercherCandidat(Candidat *tCand[], int tMax, int numeroC, int *trouve);
Choix ** insererChoix(Choix *tChoix[], int *nombreChoix);
Choix ** supprimerChoix(Choix *tChoix[], int *nombreChoix);
void miseAJourChoixCand(Choix *tChoix[], int nombreChoix);
void miseAJourChoixResp(Choix *tChoix[], int pos);
int miseAJourChoixCand(Choix *tChoix[], int nombreChoix);
/* void miseAJourChoixResp(Choix *tChoix[], int pos); */
Candidat ** creerCandidat(Candidat *tCand[], int *tMax);
/* Fonctions de file d'attente */
@ -169,11 +169,11 @@ Candidat ** creerCandidat(Candidat *tCand[], int *tMax);
FileCand filenouv(void);
FileCand adjq(FileCand f, Candidat *c);
FileCand supt(FileCand f);
FileCand supCand(FileCand f, int numeroC);
Candidat * tete(FileCand f);
int longueurFile(FileCand f);
bool vide(FileCand f);
int positionFileAttente(FileCand f, int numeroC);
/* Fonctions globale, menus*/
void globale2(void);
void globale(void);
void menuCandidat(Candidat *tCand[], int tMax);

@ -123,9 +123,9 @@ void afficherChoix(Choix *c) /* Fonction permettant d'afficher les informations
void afficherCandidat(Candidat *c) /* Fonction permettant d'afficher les informations d'un candidat donné en paramètre */
{
printf("|---------------------------------------------------------------------------------------------------------|\n");
printf("| %-4d | %-32s | %-32s | %2.2f | %2.2f | %2.2f | %2.2f |\n", c->numeroC, c->nom, c->prenom, c->notes[0], c->notes[1], c->notes[2], c->notes[3]);
printf("|---------------------------------------------------------------------------------------------------------|\n");
printf("|-------------------------------------------------------------------------------------------------------------------|\n");
printf("| %-4d | %-32s | %-32s | %2.2f | %2.2f | %2.2f | %2.2f | %2.2f |\n", c->numeroC, c->nom, c->prenom, c->notes[0], c->notes[1], c->notes[2], c->notes[3], c->moyenne);
printf("|-------------------------------------------------------------------------------------------------------------------|\n");
}
void afficherCandChoix(Candidat *tCand[],int tMax) /* Fonction permettant d'afficher tous les candidats du tableau tCand ainsi que tous leurs choix */
@ -133,12 +133,12 @@ void afficherCandChoix(Candidat *tCand[],int tMax) /* Fonction permettant d'aff
int i, j;
for(i = 0; i < tMax; i++)
{
printf("_____________________________________________________________________________________________________________\n");
printf("| Candidat |\n");
printf("_____________________________________________________________________________________________________________________\n");
printf("| Candidat |\n");
afficherCandidat(tCand[i]);
printf("\n");
printf("_______________________________________________________________________________\n");
printf("| Choix |\n");
printf("_________________________________________________________________________________\n");
printf("| Choix |\n");
for(j = 0; j < tCand[i]->nombreChoix; j++)
{
afficherChoix(tCand[i]->tChoix[j]);
@ -356,7 +356,7 @@ Choix ** supprimerChoix(Choix *tChoix[], int *nombreChoix) /* Fonction permettan
}
void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant de mettre à jour la décision d'un candidat concernant un de ses choix */
int miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant de mettre à jour la décision d'un candidat concernant un de ses choix */
{
int pos, trouve, saisie;
char ville[31], dep[31];
@ -370,7 +370,7 @@ void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant
if(trouve == 0)
{
printf("Erreur, ce choix ne figure pas dans votre liste\n");
return;
return -2;
}
system("clear");
if(tChoix[pos]->decisionCand == 0)
@ -389,26 +389,26 @@ void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant
if(saisie == 1)
{
tChoix[pos]->decisionCand = 1;
return;
return 1;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = -1;
return;
return -1;
}
if(saisie == 3)
{
return;
return 0;
}
}
}
void miseAJourChoixResp(Choix *tChoix[], int pos) /* Fontcion permettant de mettre à jour la décision d'un responsable d'admission concernant un candidat */
/*void miseAJourChoixResp(Choix *tChoix[], int pos) Fontcion permettant de mettre à jour la décision d'un responsable d'admission concernant un candidat
{
int saisie;
system("clear");
if(tChoix[pos]->decisionCand == 0) /* Affichage d'un menu adapté pour chaque cas ; le candidat peut choisir entre deux option ou bien ne rien faire */
if(tChoix[pos]->decisionCand == 0) Affichage d'un menu adapté pour chaque cas ; le candidat peut choisir entre deux option ou bien ne rien faire
{
printf("Votre décision est actuellement en attente\n\n");
printf("|---------------------------------------|\n");
@ -470,7 +470,7 @@ void miseAJourChoixResp(Choix *tChoix[], int pos) /* Fontcion permettant de mett
return;
}
}
}
}*/
Candidat ** creerCandidat(Candidat *tCand[], int *tMax)
@ -644,11 +644,6 @@ FileCand supt(FileCand f)
return f;
}
FileCand supCand(FileCand f, int numeroC)
{
}
Candidat * tete(FileCand f)
{
if(vide(f))
@ -706,6 +701,100 @@ void afficher(FileCand f)
printf("\n");
}
/************************************* Fonctions de liste d'admission ***************************************/
/************************************************************************************************************/
/************************************************************************************************************/
ListeDept listeDeptNouv(void) /*Permet de créer un liste vide puis la retourne à la fonction appelante.*/
{
ListeDept lDept;
lDept = NULL;
return lDept;
}
ListeDept insererEntete(ListeDept lDept,Departement d) /*Permet d'insérer un MaillonDept en début d'une liste passée en paramètre puis renvoie cette même liste*/
{
MaillonDept *m; /* Création d'un pointeur vers une structure MaillonDept */
m = (MaillonDept *)malloc(sizeof(MaillonDept)); /* Allocation d'un espace mémoire pour le nouveau maillon */
if(m == NULL)
{
printf("Problème d'allocation mémoire lors de l'insertion\n"); /* Message d'erreur en cas de problème de malloc */
exit(1);
}
m->d = d; /* Affecte le département passé en paramètre à l'attribut d du nouveau maillon */
m->suiv = lDept;
return m;
}
ListeDept insererDept(ListeDept lDept, Departement d) /* Permet d'insérer un maillon dans une liste donnée en paramètre dans l'ordre alpĥabétique/croissant et retourne cette liste */
{
if(lDept == NULL) /* Si la liste est vide, insère le nouveau maillon en tête */
{
return insererEntete(lDept,d);
}
if(strcmp(d.dept, lDept->d.dept) < 0) /* Si le nom du département est inférieur à celui de la liste testé, le maillon est inséré en tête*/
{
return insererEntete(lDept,d);
}
if(strcmp(d.dept,lDept->d.dept) == 0) /* Si le maillon existe déjà, retourne la liste sans changement */
{
printf("Département déjà présent dans cet IUT\n");
return lDept;
}
lDept->suiv = insererDept(lDept->suiv,d); /* Si aucun cas précédent n'est respecté, recommence avec le maillon suivant de la liste */
return lDept;
}
ListeDept supprimerEntete(ListeDept lDept) /* Permet de supprimer un maillon en tête de la liste donnée en paramètre et retourne cette liste */
{
ListeDept aux;
if(lDept == NULL) /* Si la liste est vide, quitte le programme car cela provoquerait une erreur */
{
printf("Opération interdite\n");
exit(1);
}
aux = lDept; /* On affecte l'adresse de la liste actuelle à une variable temporaire */
lDept = lDept->suiv; /* On supprime le maillon */
free(aux); /* On libère l'espace mémoire du maillon supprimer*/
return lDept;
}
ListeDept supprimerDept(ListeDept lDept, char *dep) /* Permet de supprimer un maillon d'une liste lDept passée en paramètre à partir de son attribut nom de département (dept) et retourne cette liste */
{
if(lDept == NULL) /* La liste est vide, on la retourne sans changements */
{
return lDept;
}
if(strcmp(dep, lDept->d.dept) < 0) /* Le maillon à supprimer n'existe pas, on retourne la liste sans changement */
{
return lDept;
}
if(strcmp(dep,lDept->d.dept) == 0) /* Le maillon à supprimer est trouvé, on le supprime */
{
return supprimerEntete(lDept);
}
lDept->suiv = supprimerDept(lDept->suiv,dep); /* Aucune des conditions précédentes n'a été respectée, on recommence avec le maillon suivant */
return lDept;
}
int longueur(ListeDept lDept) /* Permet d'obtenir la longueur d'une liste passée en paramètre et retourne le nombre de maillons */
{
int compt = 0; /* On déclare un compteur pour compter le nombre de maillons */
while(lDept != NULL) /* Tant que la liste n'est pas vide, on incrémente le compteur de 1 et on passe au maillon suivant */
{
compt = compt + 1;
lDept = lDept->suiv;
}
return compt;
}
bool vide(ListeDept lDept) /* Permet de savoir si une liste est vide et retourne un booléen */
{
if(lDept == NULL)
return true;
return false;
}
/********************************** Fonction globale et menus ***********************************************/
/************************************************************************************************************/
@ -713,8 +802,8 @@ void afficher(FileCand f)
void globale(void) /* Permet de gérer l'exécution du programme */
{
int tMax, pos, trouve, i, j;
Candidat **tCand, c **aux; /* Initialisation du tableau de candidats */
int tMax, pos, trouve, i = 0, j, mini = i;
Candidat **tCand, c, **aux, *temp; /* Initialisation du tableau de candidats */
tCand = chargementCandidats(&tMax); /* Remplissage du tableau par chargement */
triCandidats(tCand, tMax); /* Tri du tableau */
for(i = 0; i < tMax; i++) /* Tri du tableau choix pour chaque candidat */
@ -722,9 +811,21 @@ void globale(void) /* Permet de gérer l'exécution du programme */
triChoix(tCand[i]->tChoix, tCand[i]->nombreChoix);
}
aux = tCand;
while(aux != )
for(i = 0; i < tMax - 1; i++)
{
for(j = i + 1; j < tMax; j++)
{
if(tCand[j]->moyenne < tCand[i]->moyenne)
{
mini = j;
}
}
temp = tCand[i];
tCand[i] = tCand[mini];
tCand[mini] = temp;
}
//menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */
afficherCandChoix(tCand, tMax);
afficherCandChoix(aux, tMax);
sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */
}

@ -48,7 +48,7 @@ typedef struct maillonCand
{
Candidat *c;
struct maillonCand *suiv;
} MaillonCandidat, *ListeCand;
} MaillonCandidat;
typedef struct
{
@ -94,8 +94,8 @@ int rechercherCandidat(Candidat *tCand[], int tMax, int numeroC, int *trouve);
Choix ** insererChoix(Choix *tChoix[], int *nombreChoix);
Choix ** supprimerChoix(Choix *tChoix[], int *nombreChoix);
void miseAJourChoixCand(Choix *tChoix[], int nombreChoix);
void miseAJourChoixResp(Choix *tChoix[], int pos);
int miseAJourChoixCand(Choix *tChoix[], int nombreChoix);
/* void miseAJourChoixResp(Choix *tChoix[], int pos); */
Candidat ** creerCandidat(Candidat *tCand[], int *tMax);
/* Fonctions de file d'attente */
@ -103,9 +103,9 @@ Candidat ** creerCandidat(Candidat *tCand[], int *tMax);
FileCand filenouv(void);
FileCand adjq(FileCand f, Candidat *c);
FileCand supt(FileCand f);
FileCand supCand(FileCand f, int numeroC);
Candidat * tete(FileCand f);
int longueurFile(FileCand f);
bool vide(FileCand f);
int positionFileAttente(FileCand f, int numeroC);
/* Fonctions globale, menus*/

Loading…
Cancel
Save