diff --git a/header/sae.h b/header/sae.h index 8da1861..9d9cd0d 100644 --- a/header/sae.h +++ b/header/sae.h @@ -133,7 +133,7 @@ void menuAdmin(VilleIut *tiut[], int nbVilles); void afficherCandidat(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..184f5ca 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 e20dcf4..15830a3 100644 --- a/source/sae.c +++ b/source/sae.c @@ -732,58 +732,31 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) afficherCandidat(candidats[i]); } } +*/ -int creerCandid(Candidat tCand[], int nbCandidats) +int creerCandidat(Candidat *tCand[], int nbCandidats) { int i=0; - Candidat c; - - printf("Rentrez le numéro du candidat :"); - scanf("%d%*c",&c.numero); - while(inumero = nbCandidats; + 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("Prénom du candidat (peut contenir des espaces): "); - fgets(c.prenom, 50, stdin); - c.prenom[strlen(c.prenom) - 1] = '\0'; + 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 une note : "); - scanf("%f", &c.notes[i]); - printf("%f", c.notes[i]); - i = i + 1; - } - printf("Nombre de choix de candidatures : "); - scanf("%d%*c", &c.nbChoix); - c.nbChoix = (Choix *) malloc (c.nbChoix*sizeof(Choix)); - if(c.nbChoix==NULL) - { - printf("Problème malloc\n"); - exit(1); - } - i=0; - while(inotes[i]); i = i + 1; } - printf("%d %s %s %f %d %s %s %d", c.numero, c.nom, c.prenom, c.notes[1], c.nbChoix, c.choix[0].ville, c.choix[0].departement, c.choix[0].decisionDepartement, c.choix[0].validationCandidat); + c->lchoix = listenouv(); + c = (Candidat *) malloc (sizeof(Candidat)); + tCand[nbCandidats] = c; return nbCandidats + 1; } diff --git a/source/test.c b/source/test.c index 0eb50d3..ece531e 100644 --- a/source/test.c +++ b/source/test.c @@ -40,11 +40,11 @@ void guillaume(void) { - Candidat tCandid[50]; + Candidat *tCandid[50]; int nbCandidats=2; - nbCandidats = creerCandid(tCandid, nbCandidats); - printf("\n%d", nbCandidats); + nbCandidats = creerCandidat(tCandid, nbCandidats); + printf("\n%d\n", nbCandidats); }