diff --git a/header/sae.h b/header/sae.h index cf1b334..b5cfcad 100644 --- a/header/sae.h +++ b/header/sae.h @@ -133,7 +133,7 @@ void menuAdmin(VilleIut *tiut[], int nbVilles); void afficherUnCandidat(Candidat candidat); void afficherCandidats(Candidat **candidats, int nbCandidats); -int creerCandid(Candidat tCand[], int nbCandidats); +int creerCandidat(Candidat *tCand[], int nbCandidats); ListeDeptV2 configurationDeptV2( ListeDept ldept ); diff --git a/source/listeDepartements.c b/source/listeDepartements.c index a619668..369411f 100644 --- a/source/listeDepartements.c +++ b/source/listeDepartements.c @@ -99,7 +99,7 @@ ListeDept ajouterDept(ListeDept ldept, char nomDept[], char resp[], int nbP) * * @return La nouvelle liste de départements vide. */ -ListeDept listenouv() +ListeDept listenouv(void) { ListeDept l; diff --git a/source/main.c b/source/main.c index 70adc37..08240ef 100644 --- a/source/main.c +++ b/source/main.c @@ -8,8 +8,8 @@ int main(void) // #ifdef _WIN32 // color // #endif - - testCharge(); + //guillaume(); + //testCharge(); //Globale(); //testJean(); return 0; diff --git a/source/sae.c b/source/sae.c index 535eb96..0beb9a8 100644 --- a/source/sae.c +++ b/source/sae.c @@ -732,64 +732,57 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) void afficherCandidats(Candidat **candidats, int nbCandidats) { for (int i = 0; i < nbCandidats; i++) + { printf("\nCandidat numero %8d | Nom : %10s | Prenom : %10s \n", candidats[i] -> numero, candidats[i] -> nom, candidats[i] -> prenom); + } +} + +/** + * @brief Permet de créer un candidat + * + * @param tCand Tableau de pointeur sur une structure de candidat + * @param nbCandidats nombre de candidats créés + * + * @return Retourne le nombre de candidats + */ +int creerCandidat(Candidat *tCand[], int nbCandidats) +{ + int i=0; + Candidat *c; + + c = (Candidat *) malloc (sizeof(Candidat)); + if(c==NULL) + { + printf("Probleme malloc\n"); + exit(1); + } + c->numero = nbCandidats+1; + printf("Le numero du candidat entrain d'etre cree est : %d\n", c->numero); + printf("Nom du candidat (peut contenir des espaces): "); + fgets(c->nom, 50, stdin); + c->nom[strlen(c->nom) - 1] = '\0'; + printf("Prenom du candidat (peut contenir des espaces): "); + fgets(c->prenom, 50, stdin); + c->prenom[strlen(c->prenom) - 1] = '\0'; + i=0; + while(i<4) + { + printf("Rentrez la note numero %d : ", i+1); + scanf("%f", &c->notes[i]); + while(c->notes[i] < 0 || c->notes[i] > 20) + { + printf("Erreur, la note doit etre comprise entre 0 et 20.\nRessaisir la note numero %d : ", i+1); + scanf("%f", &c->notes[i]); + } + i = i + 1; + } + c->lchoix = listenouvC(); + tCand[nbCandidats] = c; + return nbCandidats + 1; } -// int creerCandid(Candidat tCand[], int nbCandidats) -// { -// int i=0; -// Candidat c; - -// printf("Rentrez le numéro du candidat :"); -// scanf("%d%*c",&c.numero); -// while(i