Ajout des fonctions de suppression et d'ajout de choix pour un candidat

master
Kyllian Chabanon 2 years ago
parent 88af5f676a
commit abc75ca35e

@ -69,6 +69,8 @@ int nbCandidatsAttente(Etudiant *tetud[], int nbCandidats);
float modifNoteMin(float noteMin[]);
float modifNoteExel(float noteExel[]);
int modifNbPlaces(int nbPlaces);
void ajouterCandidature(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int nbVillesIUT);
void supprimerCandidature(Etudiant *tetud[], int nbCandidats);
// Liste Choix
ListeChoix listenouvChoix(void);

@ -3,11 +3,15 @@
Dufour
Albert
19.00 4.00 16.00 3.00
1
2
Clermont-Ferrand
Informatique
2
0
Grenoble
Informatique
0
0
2
Michel
Jacques

@ -7,7 +7,9 @@ void global(void)
Etudiant *tetud[100];
nbVilles = chargementVillesIUT(tiut);
nbCandidats = chargerCandidats(tetud);
menu(tiut, &nbVilles, tetud, &nbCandidats);
//menu(tiut, &nbVilles, tetud, &nbCandidats);
ajouterCandidature(tetud, nbCandidats, tiut, nbVilles);
afficherCandidats(tetud, nbCandidats);
sauvegardeVillesIUT(tiut, nbVilles);
sauvegarderCandidats(tetud, nbCandidats);
}

@ -303,13 +303,87 @@ int modifNbPlaces(int nbPlaces)
return nbPlaces;
}
int ajouterCandidat(Candidat *tiut[])
/*int ajouterCandidat(Etudiant *tiut[])
{
Candidat cand;
Etudiant cand;
printf("Entrez votre nom et votre prénom :\n> ");
scanf("%s%s", cand.nom, cand.prenom)
scanf("%s%s", cand.nom, cand.prenom);
printf("Entrez vos notes en : mathématiques, français, anglais et en spécialité :\n> ");
scanf("%f%f%f%f", cand.tabNotes[0], cand.tabNotes[1], cand.tabNotes[2], cand.tabNotes[3]);
printf("Entrez votre nombre de choix : ");
scanf("%d", cand.nbChoix)
}*/
void ajouterCandidature(Etudiant *tetud[], int nbCandidats, VilleIUT *tiut[], int nbVillesIUT)
{
int num, posCand, posVille;
char ville[30], dept[30];
bool trouve;
Choix c;
//! AUTHENTIFICATION
printf("Entrez votre numéro de candidat :\n> ");
scanf("%d", &num);
posCand = rechercheCandidat(tetud, nbCandidats, num, &trouve);
if (!trouve)
{
printf("Numéro de candidat non trouvé.");
return;
}
printf("Entrez la ville du département que vous souhaitez ajouter :\n> ");
scanf("%s", ville);
posVille = rechercheVille(tiut, nbVillesIUT, ville, &trouve);
if (!trouve)
{
printf("Ville non trouvée.");
return;
}
printf("Entrez le département que vous souhaitez ajouter :\n> ");
scanf("%s", dept);
rechercheDept(tiut[posVille]->ldept, dept, &trouve);
if (!trouve)
{
printf("Département non trouvé.");
return;
}
strcpy(c.ville, ville);
strcpy(c.departement, dept);
c.decisionAdmission = 0;
c.decisionCandidat = 0;
tetud[posCand]->lChoix = insererChoix(tetud[posCand]->lChoix, c);
tetud[posCand]->nbChoix++;
}
void supprimerCandidature(Etudiant *tetud[], int nbCandidats)
{
int num, posCand, posVille;
char ville[30], dept[30];
bool trouve;
Choix c;
//! AUTHENTIFICATION
printf("Entrez votre numéro de candidat :\n> ");
scanf("%d", &num);
posCand = rechercheCandidat(tetud, nbCandidats, num, &trouve);
if (!trouve)
{
printf("Numéro de candidat non trouvé.");
return;
}
printf("Entrez la ville du département que vous souhaitez supprimer :\n> ");
scanf("%s", c.ville);
printf("Entrez le département que vous souhaitez supprimer :\n> ");
scanf("%s", c.departement);
trouve = rechercheChoix(tetud[posCand]->lChoix, c);
if (!trouve)
{
printf("Choix non trouvé.");
return;
}
tetud[posCand]->lChoix = supprimerChoix(tetud[posCand]->lChoix, c);
tetud[posCand]->nbChoix--;
}
// ? 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 ?

@ -60,13 +60,16 @@ ListeChoix supprimerChoix(ListeChoix lc, Choix choix)
if (strcmp(choix.ville, lc->choix.ville) < 0)
return lc;
if (strcmp(choix.ville, lc->choix.ville) == 0)
{
if (strcmp(choix.departement, lc->choix.departement) == 0)
{
return supprimerEnTeteChoix(lc);
lc->suiv = supprimerChoix(lc->suiv, lc->choix);
return lc;
}
}
return supprimerChoix(lc->suiv, choix);
}
bool rechercherChoix(ListeChoix lc, Choix choix)
bool rechercheChoix(ListeChoix lc, Choix choix)
{
if (videChoix(lc))
return false;
@ -75,7 +78,7 @@ bool rechercherChoix(ListeChoix lc, Choix choix)
if (strcmp(choix.ville, lc->choix.ville) == 0)
if (strcmp(choix.departement, lc->choix.departement) == 0)
return true;
return rechercherChoix(lc->suiv, lc->choix);
return rechercheChoix(lc->suiv, lc->choix);
}
Choix TeteChoix(ListeChoix lc)

Loading…
Cancel
Save