|
|
@ -61,6 +61,56 @@ void ajouterCandidature(Candidat* candidat, Candidature* candidature) {
|
|
|
|
candidat->nbCandidatures+=1;
|
|
|
|
candidat->nbCandidatures+=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void menuCandidat_candidater(VilleIUT** tiut, int nbVilles, Candidat* candidat) {
|
|
|
|
|
|
|
|
Candidature* candid = creerCandidature();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char searchIUT[LEN_MAX], searchDept[LEN_MAX];
|
|
|
|
|
|
|
|
printf("Entrez la ville dans laquelle vous souhaitez candidater : ");
|
|
|
|
|
|
|
|
scanf("%s", searchIUT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(strcasecmp(searchIUT, "q") == 0)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = rechercherVille(tiut, nbVilles, searchIUT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(i == -1) {
|
|
|
|
|
|
|
|
fprintf(stderr, "\e[1;91mErreur: la ville '%s' n'est pas dans la liste des IUT.\e[0m\n\n", searchIUT);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("Entrez le département dans lequel vous souhaitez candidater : ");
|
|
|
|
|
|
|
|
scanf("%*c%[^\n]", searchDept);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
ListeDept liste = tiut[i]->ldept;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(strcmp(liste->departement, searchDept) == 0)
|
|
|
|
|
|
|
|
found=1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(liste->suiv != NULL) {
|
|
|
|
|
|
|
|
liste = liste->suiv;
|
|
|
|
|
|
|
|
if(strcmp(liste->departement, searchDept) == 0)
|
|
|
|
|
|
|
|
found=1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(found == 0) {
|
|
|
|
|
|
|
|
fprintf(stderr, "\e[1;91mErreur: le département '%s' n'existe pas dans l'IUT '%s'.\e[0m\n\n", searchDept, searchIUT);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strcpy(candid->ville, searchIUT);
|
|
|
|
|
|
|
|
strcpy(candid->departement, searchDept);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(checkCandidature(candidat, *candid) == -1) {
|
|
|
|
|
|
|
|
fprintf(stderr, "\n\e[1;91mErreur: vous avez déjà candidaté pour le département '%s' dans l'IUT '%s'.\e[0m\n\n", searchDept, searchIUT);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ajouterCandidature(candidat, candid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n\e[1;32mVotre candidature au département '%s' à l'IUT '%s' a bien été prise en compte !\e[0m\n\n", searchDept, searchIUT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int checkCandidature(Candidat* candidat, Candidature candid) {
|
|
|
|
int checkCandidature(Candidat* candidat, Candidature candid) {
|
|
|
|
int nbCandidatures = candidat->nbCandidatures;
|
|
|
|
int nbCandidatures = candidat->nbCandidatures;
|
|
|
|
|
|
|
|
|
|
|
@ -83,6 +133,7 @@ void afficherListeCandidats(ListeCandidats liste, int nbCandidats) {
|
|
|
|
for (int i=0; i<nbCandidats; i++) {
|
|
|
|
for (int i=0; i<nbCandidats; i++) {
|
|
|
|
memcpy(&liste2[i], &liste[i], sizeof(Candidat*));
|
|
|
|
memcpy(&liste2[i], &liste[i], sizeof(Candidat*));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qsort(liste2, nbCandidats, sizeof(Candidat*), compareCandidats);
|
|
|
|
qsort(liste2, nbCandidats, sizeof(Candidat*), compareCandidats);
|
|
|
|
|
|
|
|
|
|
|
|