Ajout des structures de la fonction suppression candidat et maj de misaAJourCand

master
Johnny RATTON 2 years ago
parent d2150e4d55
commit 13a9d34ad0

@ -904,6 +904,7 @@ Candidat * lireCandidat(FILE *flot) /* Fonction permettant de lire un candidat d
fgets(c->prenom, 31, flot);
c->prenom[strlen(c->prenom) - 1] = '\0';
fscanf(flot, "%f%f%f%f%*c", &c->notes[0], &c->notes[1], &c->notes[2], &c->notes[3]);
c->moyenne = (c->notes[0] + c->notes[1] + c->notes[2] + c->notes[3]) / 4;
fscanf(flot, "%d%*c", &c->nombreChoix);
c->tChoix = (Choix **)malloc(sizeof(Choix *) * c->nombreChoix); /* Allocation dynamique du tableau de pointeurs vers des structures Choix*/
if(c->tChoix == NULL) /* pour le chargement des choix du candidats */
@ -1225,83 +1226,27 @@ void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant
return;
}
system("clear");
if(tChoix[pos]->decisionCand == -1) /* Affichage d'un menu adapté pour chaque cas ; le candidat peut choisir entre deux option ou bien ne rien faire */
{
printf("Vous avez actuellement refusé la proposition d'admission de l'établissement\n\n");
printf("|---------------------------------------|\n");
printf("| Que souhaitez-vous faire ? |\n");
printf("|---------------------------------------|\n");
printf("| 1 Accepter la proposition d'admission |\n");
printf("| 2 Prendre un temps de réflexion |\n");
printf("| 3 Ne rien changer |\n");
printf("|---------------------------------------|\n");
printf("Saisie : ");
scanf("%d%*c", &saisie);
printf("\n");
if(saisie == 1)
{
tChoix[pos]->decisionCand = 1;
return;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = 0;
return;
}
if(saisie == 3)
{
return;
}
}
else if(tChoix[pos]->decisionCand == 0)
if(tChoix[pos]->decisionCand == 0)
{
printf("Vous n'avez actuellement pris aucune décision\n\n");
printf("|---------------------------------------|\n");
printf("| Que souhaitez-vous faire ? |\n");
printf("|---------------------------------------|\n");
printf("| 1 Refuser la proposition d'admission |\n");
printf("| 2 Accepter la proposition d'admission |\n");
printf("| 1 Accepter la proposition d'admission |\n");
printf("| 2 Refuser la proposition d'admission |\n");
printf("| 3 Ne rien changer |\n");
printf("|---------------------------------------|\n");
printf("Saisie : ");
scanf("%d%*c", &saisie);
printf("\n");
if(saisie == 1)
{
tChoix[pos]->decisionCand = -1;
return;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = 1;
return;
}
if(saisie == 3)
{
return;
}
}
else if(tChoix[pos]->decisionCand == 1)
{
printf("Vous avez actuellement accepté la proposition d'admission de l'établissement\n\n");
printf("|---------------------------------------|\n");
printf("| Que souhaitez-vous faire ? |\n");
printf("|---------------------------------------|\n");
printf("| 1 Refuser la proposition d'admission |\n");
printf("| 2 Prendre un temps de réflexion |\n");
printf("| 3 Ne rien changer |\n");
printf("|---------------------------------------|\n");
printf("Saisie : ");
scanf("%d%*c", &saisie);
printf("\n");
if(saisie == 1)
{
tChoix[pos]->decisionCand = -1;
return;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = 0;
tChoix[pos]->decisionCand = -1;
return;
}
if(saisie == 3)
@ -1552,6 +1497,11 @@ FileCand supt(FileCand f)
return f;
}
FileCand supCand(FileCand f, int numeroC)
{
}
Candidat * tete(FileCand f)
{
if(vide(f))
@ -1616,17 +1566,17 @@ void afficher(FileCand f)
void globale(void) /* Permet de gérer l'exécution du programme */
{
int tMax, pos, trouve, i;
Candidat **tCand, c; /* Initialisation du tableau de candidats */
int tMax, pos, trouve, i, j;
Candidat **tCand, c **aux; /* 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 */
{
triChoix(tCand[i]->tChoix, tCand[i]->nombreChoix);
}
pos = rechercherChoix(tCand[3]->tChoix, tCand[3]->nombreChoix, "Clermont-Ferrand", "Informatique", &trouve);
miseAJourChoixResp(tCand[3]->tChoix, pos);
menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */
aux = tCand;
while(aux != )
//menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */
afficherCandChoix(tCand, tMax);
sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */
}
@ -1695,4 +1645,13 @@ void menuCandidat(Candidat *tCand[], int tMax) /* Fonction affichant un menu ada
scanf("%d%*c", &saisie);
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");
}

@ -104,6 +104,7 @@ typedef struct
char nom[31];
char prenom[31];
float notes[4];
float moyenne;
int nombreChoix;
Choix **tChoix;
} Candidat;
@ -113,7 +114,7 @@ typedef struct maillonCand
{
Candidat *c;
struct maillonCand *suiv;
} MaillonCandidat;
} MaillonCandidat, *ListeCand;
typedef struct
{
@ -168,10 +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 longueur(FileCand f);
int longueurFile(FileCand f);
int positionFileAttente(FileCand f, int numeroC);
/* Fonctions globale, menus*/
void globale(void);
void globale2(void);
void menuCandidat(Candidat *tCand[], int tMax);

@ -51,6 +51,7 @@ Candidat * lireCandidat(FILE *flot) /* Fonction permettant de lire un candidat d
fgets(c->prenom, 31, flot);
c->prenom[strlen(c->prenom) - 1] = '\0';
fscanf(flot, "%f%f%f%f%*c", &c->notes[0], &c->notes[1], &c->notes[2], &c->notes[3]);
c->moyenne = (c->notes[0] + c->notes[1] + c->notes[2] + c->notes[3]) / 4;
fscanf(flot, "%d%*c", &c->nombreChoix);
c->tChoix = (Choix **)malloc(sizeof(Choix *) * c->nombreChoix); /* Allocation dynamique du tableau de pointeurs vers des structures Choix*/
if(c->tChoix == NULL) /* pour le chargement des choix du candidats */
@ -372,83 +373,27 @@ void miseAJourChoixCand(Choix *tChoix[], int nombreChoix) /* Fontcion permettant
return;
}
system("clear");
if(tChoix[pos]->decisionCand == -1) /* Affichage d'un menu adapté pour chaque cas ; le candidat peut choisir entre deux option ou bien ne rien faire */
{
printf("Vous avez actuellement refusé la proposition d'admission de l'établissement\n\n");
printf("|---------------------------------------|\n");
printf("| Que souhaitez-vous faire ? |\n");
printf("|---------------------------------------|\n");
printf("| 1 Accepter la proposition d'admission |\n");
printf("| 2 Prendre un temps de réflexion |\n");
printf("| 3 Ne rien changer |\n");
printf("|---------------------------------------|\n");
printf("Saisie : ");
scanf("%d%*c", &saisie);
printf("\n");
if(saisie == 1)
{
tChoix[pos]->decisionCand = 1;
return;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = 0;
return;
}
if(saisie == 3)
{
return;
}
}
else if(tChoix[pos]->decisionCand == 0)
if(tChoix[pos]->decisionCand == 0)
{
printf("Vous n'avez actuellement pris aucune décision\n\n");
printf("|---------------------------------------|\n");
printf("| Que souhaitez-vous faire ? |\n");
printf("|---------------------------------------|\n");
printf("| 1 Refuser la proposition d'admission |\n");
printf("| 2 Accepter la proposition d'admission |\n");
printf("| 1 Accepter la proposition d'admission |\n");
printf("| 2 Refuser la proposition d'admission |\n");
printf("| 3 Ne rien changer |\n");
printf("|---------------------------------------|\n");
printf("Saisie : ");
scanf("%d%*c", &saisie);
printf("\n");
if(saisie == 1)
{
tChoix[pos]->decisionCand = -1;
return;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = 1;
return;
}
if(saisie == 3)
{
return;
}
}
else if(tChoix[pos]->decisionCand == 1)
{
printf("Vous avez actuellement accepté la proposition d'admission de l'établissement\n\n");
printf("|---------------------------------------|\n");
printf("| Que souhaitez-vous faire ? |\n");
printf("|---------------------------------------|\n");
printf("| 1 Refuser la proposition d'admission |\n");
printf("| 2 Prendre un temps de réflexion |\n");
printf("| 3 Ne rien changer |\n");
printf("|---------------------------------------|\n");
printf("Saisie : ");
scanf("%d%*c", &saisie);
printf("\n");
if(saisie == 1)
{
tChoix[pos]->decisionCand = -1;
return;
}
if(saisie == 2)
{
tChoix[pos]->decisionCand = 0;
tChoix[pos]->decisionCand = -1;
return;
}
if(saisie == 3)
@ -699,6 +644,11 @@ FileCand supt(FileCand f)
return f;
}
FileCand supCand(FileCand f, int numeroC)
{
}
Candidat * tete(FileCand f)
{
if(vide(f))
@ -763,17 +713,17 @@ void afficher(FileCand f)
void globale(void) /* Permet de gérer l'exécution du programme */
{
int tMax, pos, trouve, i;
Candidat **tCand, c; /* Initialisation du tableau de candidats */
int tMax, pos, trouve, i, j;
Candidat **tCand, c **aux; /* 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 */
{
triChoix(tCand[i]->tChoix, tCand[i]->nombreChoix);
}
pos = rechercherChoix(tCand[3]->tChoix, tCand[3]->nombreChoix, "Clermont-Ferrand", "Informatique", &trouve);
miseAJourChoixResp(tCand[3]->tChoix, pos);
menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */
aux = tCand;
while(aux != )
//menuCandidat(tCand, tMax); /* Appel du menu adapté au candidat */
afficherCandChoix(tCand, tMax);
sauvegarder(tCand, tMax); /* Sauvegarde du tableau de candidats */
}

@ -38,6 +38,7 @@ typedef struct
char nom[31];
char prenom[31];
float notes[4];
float moyenne;
int nombreChoix;
Choix **tChoix;
} Candidat;
@ -47,7 +48,7 @@ typedef struct maillonCand
{
Candidat *c;
struct maillonCand *suiv;
} MaillonCandidat;
} MaillonCandidat, *ListeCand;
typedef struct
{
@ -102,8 +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 longueur(FileCand f);
int longueurFile(FileCand f);
int positionFileAttente(FileCand f, int numeroC);
/* Fonctions globale, menus*/

Loading…
Cancel
Save