From b02f51bec8f9c18f84d7be1e319a50c7af2eddec Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 14:13:28 +0100 Subject: [PATCH 01/19] Debug afficherDeptDonne et existeVille --- source/sae.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sae.c b/source/sae.c index fa52ede..864db86 100644 --- a/source/sae.c +++ b/source/sae.c @@ -514,13 +514,13 @@ void afficherDeptIutDonne(VilleIut **villeIut, int nbVille) afficheVillesIUT(villeIut, nbVille); printf("Veuillez saisir le nom de l'iut que vous voulez afficher.\n"); scanf("%s", nom); - res = existeVille(villeiut, nbVille, nom); + res = existeVille(villeIut, nom, nbVille); if (res == -1) { printf("Cet IUT n'existe pas\n"); return ; } - afficherListe(villeiut[res]->lDept); + afficherListe(villeIut[res]->lDept); } /** @@ -612,7 +612,7 @@ int existeVille( VilleIut * tIut[], char ville[], int nbvilles ) int i = 0; //recherche de la ville - for( e = 0; i < nbvilles; i ++ ) + for( i = 0; i < nbvilles; i ++ ) { if ( strcmp( tIut[i] -> nom, ville ) == 0 ) return i; // ville trouvée... } From 6644d1602581dbe8cfe0b14c5d842d4dfb0811c8 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 14:15:37 +0100 Subject: [PATCH 02/19] Plus de commentaires pour existeVille et Affichervileldonne --- source/sae.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/sae.c b/source/sae.c index cba75ca..864db86 100644 --- a/source/sae.c +++ b/source/sae.c @@ -506,7 +506,7 @@ int modifieRespDept(VilleIut *tVilleIut[], int nbVilles, char ville[], char nomD return 0; } -/*void afficherDeptIutDonne(VilleIut **villeIut, int nbVille) +void afficherDeptIutDonne(VilleIut **villeIut, int nbVille) { int res; char *nom; @@ -607,7 +607,7 @@ void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]) } } -/*int existeVille( VilleIut * tIut[], char ville[], int nbvilles ) +int existeVille( VilleIut * tIut[], char ville[], int nbvilles ) { int i = 0; @@ -617,7 +617,7 @@ void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]) if ( strcmp( tIut[i] -> nom, ville ) == 0 ) return i; // ville trouvée... } return -1; -}*/ +} /** * Affiche et gère le menu administrateur. From 5ede35386176123e619b9d38573e796498f19bad Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 14:20:32 +0100 Subject: [PATCH 03/19] lchoix, mise en commentaire de afficherCandidat et afficherCandidats --- header/sae.h | 2 +- source/sae.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/header/sae.h b/header/sae.h index a11c0c7..071c527 100644 --- a/header/sae.h +++ b/header/sae.h @@ -43,7 +43,7 @@ typedef struct char prenom[50]; float notes[4]; int nbChoix; - Choix *choix; + lChoix lchoix; }Candidat; //Proposition de structure de candidature pour la Partie 3 ( jean ) : diff --git a/source/sae.c b/source/sae.c index 864db86..81afdeb 100644 --- a/source/sae.c +++ b/source/sae.c @@ -698,7 +698,7 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) * @brief Affiche les informations d'un candidat * @param candidat Le candidat à afficher */ -void afficherCandidat(Candidat candidat) +/* void afficherCandidat(Candidat candidat) { printf("Numéro du candidat : %d\n", candidat.numero); printf("Nom : %s\n", candidat.nom); @@ -713,7 +713,7 @@ void afficherCandidat(Candidat candidat) printf(" Décision du département : %d\n", candidat.choix[i].decisionDepartement); printf(" Validation : %d\n", candidat.choix[i].validationCandidat); } -} +} */ /** * @brief Affiche la liste des candidats @@ -721,14 +721,14 @@ void afficherCandidat(Candidat candidat) * @param candidats Le tableau de candidats à afficher * @param nbCandidats Le nombre de candidats dans le tableau */ -void afficherCandidats(Candidat *candidats, int nbCandidats) +/*void afficherCandidats(Candidat *candidats, int nbCandidats) { for (int i = 0; i < nbCandidats; i++) { printf("\nCandidat %d :\n", i + 1); afficherCandidat(candidats[i]); } -} +} */ /* ================================================ From 6074d16159172a8abf7a994c8a4b634540d007b3 Mon Sep 17 00:00:00 2001 From: Siwa12100 Date: Fri, 13 Jan 2023 14:56:46 +0100 Subject: [PATCH 04/19] test commit fonctionnel Jean --- source/choix.c | 0 source/sae.c | 4 +--- 2 files changed, 1 insertion(+), 3 deletions(-) create mode 100644 source/choix.c diff --git a/source/choix.c b/source/choix.c new file mode 100644 index 0000000..e69de29 diff --git a/source/sae.c b/source/sae.c index a4f0bde..b832b81 100644 --- a/source/sae.c +++ b/source/sae.c @@ -619,6 +619,7 @@ void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]) return -1; }*/ + /** * Affiche et gère le menu administrateur. * @@ -685,9 +686,6 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) - - - /* ================================================ Partie 2 From 781dbf406c6906d0ff4444313e1bfa3424893c4e Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 15:00:48 +0100 Subject: [PATCH 05/19] creer candid --- source/main.c | 3 ++- source/result.don | 1 - source/sae.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ source/test.c | 16 ++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) delete mode 100644 source/result.don diff --git a/source/main.c b/source/main.c index 3b65606..72fb8f3 100644 --- a/source/main.c +++ b/source/main.c @@ -9,7 +9,8 @@ int main(void) // color // #endif - Globale(); + //Globale(); + guillaume(); //testJean(); return 0; diff --git a/source/result.don b/source/result.don deleted file mode 100644 index 45ebb94..0000000 --- a/source/result.don +++ /dev/null @@ -1 +0,0 @@ -Clermont-Ferrand Biologie 120 Perrier Yanic \ No newline at end of file diff --git a/source/sae.c b/source/sae.c index cc6bbb7..24a29c0 100644 --- a/source/sae.c +++ b/source/sae.c @@ -714,6 +714,62 @@ void afficherCandidats(Candidat *candidats, int nbCandidats) } +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 Date: Fri, 13 Jan 2023 15:03:22 +0100 Subject: [PATCH 06/19] commit --- donnees/result.don | 2 ++ header/sae.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 donnees/result.don diff --git a/donnees/result.don b/donnees/result.don new file mode 100644 index 0000000..0a72a8d --- /dev/null +++ b/donnees/result.don @@ -0,0 +1,2 @@ +Clermont-Ferrand Biologie 120 Perrier Yanic + diff --git a/header/sae.h b/header/sae.h index 7c665b9..2b9d485 100644 --- a/header/sae.h +++ b/header/sae.h @@ -101,7 +101,7 @@ typedef struct */ // sae.c void testJean(void); - +void guillaume(void); void Globale(void); Log * chargementLog(char * nomFichier, int * nbLog); @@ -129,6 +129,7 @@ void menuAdmin(VilleIut **villeIut, int nbVilles); void afficherCandidat(Candidat candidat); void afficherCandidats(Candidat *candidats, int nbCandidats); +int creerCandid(Candidat tCand[], int nbCandidats); ListeDeptV2 configurationDeptV2( ListeDept ldept ); From 007efcd08a63f099db749ec6b3e00e9c3c58d270 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 15:08:47 +0100 Subject: [PATCH 07/19] changement de **villeiut vers *tiut[] pour les fonctions de Jean --- header/sae.h | 16 ++++++++-------- source/sae.c | 51 ++++++++++++++++++++++++++++----------------------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/header/sae.h b/header/sae.h index 071c527..95240f1 100644 --- a/header/sae.h +++ b/header/sae.h @@ -122,14 +122,14 @@ void saisieMdp(char * mdp); void seConnecter(Log * tLog, int nbLog); void seConnecterTest(void); -int modifiePlacesDept(VilleIut **villeIut, int nbVilles, char *ville, char *nomDept, int nbP); -int modifieRespDept(VilleIut *tVilleIut[], int nbVilles, char ville[], char nomDept[], char nvNomResp[]); -void afficherDeptIutDonne(VilleIut **villeIut, int nbVille); -void afficheIUTDept(VilleIut* *villeIut, int nbVilles, char *nomDept); -void afficheVillesIUT(VilleIut **villeIut, int nbVilles); -void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]); -int existeVille( VilleIut * tIut[], char ville[], int nbvilles ); -void menuAdmin(VilleIut **villeIut, int nbVilles); +int modifiePlacesDept(VilleIut *tiut[], int nbVilles, char *ville, char *nomDept, int nbP); +int modifieRespDept(VilleIut *tiut[], int nbVilles, char ville[], char nomDept[], char nvNomResp[]); +void afficherDeptIutDonne(VilleIut *tiut[], int nbVilles); +void afficheIUTDept(VilleIut *tiut[], int nbVilles, char *nomDept); +void afficheVillesIUT(VilleIut *tiut[], int nbVilles); +void afficheNbPlacesDep(VilleIut *tiut[], int nbVilles, char nomDept[]); +int existeVille( VilleIut *tiut[], char ville[], int nbvilles ); +void menuAdmin(VilleIut *tiut[], int nbVilles); void afficherCandidat(Candidat candidat); void afficherCandidats(Candidat *candidats, int nbCandidats); diff --git a/source/sae.c b/source/sae.c index 81afdeb..6c39402 100644 --- a/source/sae.c +++ b/source/sae.c @@ -122,7 +122,7 @@ void menuVisiteur(Log * tLog, int nbLog, VilleIut *tIut[], int nbVilles) printf("Affiche le nombre de place dans un departement (En attente de Guillaume)\n"); break; case 3 : - printf("Affiche les departements d'un IUT donne (En attente de Loris)\n"); + afficherDeptIutDonne(tIut, nbVilles); break; case 4 : printf("Affiche les IUT possedant un departement donne (En attente de Jean)\n"); @@ -187,7 +187,7 @@ int choixMenuCandidat(void) int choix; choix = afficherMenuCandidat(); - while (choix < 0 || choix > 4) + while (choix < 0 || choix > 3) { clean printf("\nChoix incorrect.\n\n"); @@ -210,7 +210,6 @@ int afficherMenuCandidat(void) printf("\t1. Creer une candidature\n"); printf("\t2. Modifier une candidature\n"); printf("\t3. Supprimer une candidature\n"); - printf("\t4. Gestion des candidatures\n"); printf("\t0. Quitter\n"); printf("\nChoix : "); scanf("%d%*c", &choix); @@ -429,16 +428,16 @@ void saisieMdp(char * mdp) * * @return 1 si le département a été trouvé et modifié, 0 sinon */ -int modifiePlacesDept(VilleIut **villeIut, int nbVilles, char *ville, char *nomDept, int nbP) +int modifiePlacesDept(VilleIut *tiut[], int nbVilles, char *ville, char *nomDept, int nbP) { // Recherche de la ville et du département int i; for (i = 0; i < nbVilles; i++) { - if (strcmp(villeIut[i] -> nom, ville) == 0) + if (strcmp(tiut[i] -> nom, ville) == 0) { // Ville trouvée, recherche du département - MaillonDept *dept = villeIut[i] -> lDept; + MaillonDept *dept = tiut[i] -> lDept; while ( dept != NULL && strcmp( dept -> nomDept, nomDept) != 0) { @@ -473,16 +472,16 @@ int modifiePlacesDept(VilleIut **villeIut, int nbVilles, char *ville, char *nomD * * @return 1 si le nom du responsable a été trouvé et modifié, 0 sinon */ -int modifieRespDept(VilleIut *tVilleIut[], int nbVilles, char ville[], char nomDept[], char nvNomResp[]) +int modifieRespDept(VilleIut *tiut[], int nbVilles, char ville[], char nomDept[], char nvNomResp[]) { // Recherche de la ville et du département int i; for (i = 0; i < nbVilles; i++) { - if (strcmp(tVilleIut[i] -> nom, ville) == 0) + if (strcmp(tiut[i] -> nom, ville) == 0) { // Ville trouvée, recherche du département - MaillonDept *dept = tVilleIut[i] -> lDept; + MaillonDept *dept = tiut[i] -> lDept; while ( dept != NULL && strcmp( dept -> nomDept, nomDept) != 0) { @@ -506,31 +505,37 @@ int modifieRespDept(VilleIut *tVilleIut[], int nbVilles, char ville[], char nomD return 0; } -void afficherDeptIutDonne(VilleIut **villeIut, int nbVille) +/** +*@brief Affiche les départements d'un IUT donné +*@param tiut tableau des villes d'IUT +*@param nbVille nombre de villes d'IUT dans le tableau +*@return void +*/ +void afficherDeptIutDonne(VilleIut *tiut[], int nbVille) { int res; char *nom; - afficheVillesIUT(villeIut, nbVille); + afficheVillesIUT(tiut, nbVille); printf("Veuillez saisir le nom de l'iut que vous voulez afficher.\n"); scanf("%s", nom); - res = existeVille(villeIut, nom, nbVille); + res = existeVille(tiut, nom, nbVille); if (res == -1) { printf("Cet IUT n'existe pas\n"); return ; } - afficherListe(villeIut[res]->lDept); + afficherListe(tiut[res]->lDept); } /** * @brief Affiche les IUT possédant un département spécifique. * - * @param villeIut tableau de pointeurs sur les structures VilleIut + * @param tiut tableau de pointeurs sur les structures VilleIut * @param nbVilles nombre de villes dans le tableau villeIut * @param nomDept nom du département à rechercher */ -void afficheIUTDept(VilleIut **villeIut, int nbVilles, char *nomDept) +void afficheIUTDept(VilleIut *tiut[], int nbVilles, char *nomDept) { clean; printf("==========================================================================\n"); @@ -542,13 +547,13 @@ void afficheIUTDept(VilleIut **villeIut, int nbVilles, char *nomDept) for (i = 0; i < nbVilles; i++) { // Parcours de la liste chaînée de départements de la ville - MaillonDept *dept = villeIut[i] -> lDept; + MaillonDept *dept = tiut[i] -> lDept; while (dept != NULL) { if (strcmp(dept->nomDept, nomDept) == 0) { // Département trouvé, affichage de la ville - printf(" -> IUT de %s\n", villeIut[i] -> nom); + printf(" -> IUT de %s\n", tiut[i] -> nom); e = 1; } @@ -565,7 +570,7 @@ void afficheIUTDept(VilleIut **villeIut, int nbVilles, char *nomDept) * @param villeIut tableau de pointeurs sur les structures VilleIut * @param nbVilles nombre de villes dans le tableau villeIut */ -void afficheVillesIUT(VilleIut **villeIut, int nbVilles) +void afficheVillesIUT(VilleIut *tiut[], int nbVilles) { clean printf("==============================================================\n"); @@ -575,7 +580,7 @@ void afficheVillesIUT(VilleIut **villeIut, int nbVilles) for (int i = 0; i < nbVilles; i++) { // Affichage du nom de la ville - printf(" -> %s\n", villeIut[i]-> nom); + printf(" -> %s\n", tiut[i]-> nom); } printf(" \n\n\n"); } @@ -587,19 +592,19 @@ void afficheVillesIUT(VilleIut **villeIut, int nbVilles) * @param nbVilles nombre de villes dans le tableau villeIut * @param nomDept nom du département à rechercher */ -void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]) +void afficheNbPlacesDep(VilleIut *tiut[], int nbVilles, char nomDept[]) { int i; for (i = 0; i < nbVilles; i++) { // Parcours de la liste chaînée de départements de la ville - MaillonDept *dept = tVilleIut[i] -> lDept; + MaillonDept *dept = tiut[i] -> lDept; while (dept != NULL) { if (strcmp(dept->nomDept, nomDept) == 0) { // Département trouvé, affichage de la ville et de son nombre de places - printf("IUT de %s avec %d places.\n", tVilleIut[i] -> nom, tVilleIut[i] -> lDept -> nbP); + printf("IUT de %s avec %d places.\n", tiut[i] -> nom, tiut[i] -> lDept -> nbP); break; } dept = dept->suiv; @@ -607,7 +612,7 @@ void afficheNbPlacesDep(VilleIut *tVilleIut[], int nbVilles, char nomDept[]) } } -int existeVille( VilleIut * tIut[], char ville[], int nbvilles ) +int existeVille(VilleIut *tIut[], char ville[], int nbvilles ) { int i = 0; From 8abf1facd671d1b954f448905f1a74e759e94e1b Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 15:17:49 +0100 Subject: [PATCH 08/19] commit --- source/sae.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/sae.c b/source/sae.c index 1a9303e..dce50bd 100644 --- a/source/sae.c +++ b/source/sae.c @@ -728,7 +728,6 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) } } - int creerCandid(Candidat tCand[], int nbCandidats) { int i=0; @@ -756,14 +755,14 @@ int creerCandid(Candidat tCand[], int nbCandidats) while(i<4) { printf("Rentrez une note : "); - scanf("%f", c.notes[i]); + 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.choix = (Choix *) malloc (c.nbChoix*sizeof(Choix)); - if(c.choix==NULL) + c.nbChoix = (Choix *) malloc (c.nbChoix*sizeof(Choix)); + if(c.nbChoix==NULL) { printf("Problème malloc\n"); exit(1); From bd40c3c7bcbbca4b40095108bc7bfc83f062ccbc Mon Sep 17 00:00:00 2001 From: Siwa12100 Date: Fri, 13 Jan 2023 15:33:06 +0100 Subject: [PATCH 09/19] ajout du fihcier de choix et de ses fonctions --- header/sae.h | 5 ++++ source/choix.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ source/test.c | 2 +- 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/header/sae.h b/header/sae.h index 8da1861..32b4604 100644 --- a/header/sae.h +++ b/header/sae.h @@ -152,6 +152,11 @@ bool vide(ListeDept ldept); int longueur(ListeDept ldept); void afficherListe(ListeDept ldept); +// Choix.c +lChoix ajouterEnteteC( lChoix lchoix, char ville[], char departement[], int decision, int validation); +lChoix supprimerEnTeteC( lChoix lchoix ); +lChoix listenouvC(); + // iut.c diff --git a/source/choix.c b/source/choix.c index e69de29..2ec0fd6 100644 --- a/source/choix.c +++ b/source/choix.c @@ -0,0 +1,67 @@ +#include "../header/sae.h" + + +/** + * @brief Ajoute un choix à la liste de choix + * @param lchoix juste de choix auquel un mayon est rajouté + * @param ville La ville du nouveau choix + * @param departement Le departement du nouveau choix + * @param decision La décision du département pour le choix + * @param validation La validation du candidat pour le choix + + * @return La liste avec le nouveau maillon + */ +lChoix ajouterEnteteC( lChoix lchoix, char ville[], char departement[], int decision, int validation) +{ + Choix * c = ( Choix * ) malloc ( sizeof ( Choix )); + if ( c == NULL ) + { + printf("\n --> Erreur d'allocation memoire \n"); + exit(1); + } + + strcpy( c -> ville, ville ); + strcpy( c -> departement, departement ); + c -> decisionDepartement = decision; + c -> validationCandidat = validation; + + c -> suiv = lchoix; + lchoix = c; + + return lchoix; +} + +/** + * @brief supprime un maillon de la liste + * @param lchoix juste de choix auquel un mayon est rajouté + * + * @return La liste avec le maillon en moins + */ +lChoix supprimerEnTeteC( lChoix lchoix ) +{ + Choix * aux; + if ( lchoix == NULL ) + { + printf(" \n --> operation impossible \n"); + exit(1); + } + + aux = lchoix; + lchoix = lchoix -> suiv; + free( aux ); + + return lchoix; +} +/** + * @brief Initialise une liste vide + * @return La liste vide + */ +lChoix listenouvC() +{ + lChoix l; + l = NULL; + return l; +} + + + diff --git a/source/test.c b/source/test.c index 0eb50d3..b7e94a9 100644 --- a/source/test.c +++ b/source/test.c @@ -43,7 +43,7 @@ void guillaume(void) Candidat tCandid[50]; int nbCandidats=2; - nbCandidats = creerCandid(tCandid, nbCandidats); + //nbCandidats = creerCandid(tCandid, nbCandidats); printf("\n%d", nbCandidats); } From 3cd260105ad7f152d3807a976f913b447fc0ee63 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 16:03:46 +0100 Subject: [PATCH 10/19] commit --- header/sae.h | 2 +- source/listeDepartements.c | 2 +- source/main.c | 4 +-- source/sae.c | 57 ++++++++++---------------------------- source/test.c | 6 ++-- 5 files changed, 22 insertions(+), 49 deletions(-) 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); } From 1e44c16cc13bd869c6985ecb90975b4d61d170ea Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 16:06:21 +0100 Subject: [PATCH 11/19] commit --- source/sae.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/sae.c b/source/sae.c index 15830a3..b16774f 100644 --- a/source/sae.c +++ b/source/sae.c @@ -754,7 +754,7 @@ int creerCandidat(Candidat *tCand[], int nbCandidats) scanf("%f", &c->notes[i]); i = i + 1; } - c->lchoix = listenouv(); + c->lchoix = listenouvC(); c = (Candidat *) malloc (sizeof(Candidat)); tCand[nbCandidats] = c; return nbCandidats + 1; From bcdeb24491974b30c7e1ad6913f0e3fa2c3be9c3 Mon Sep 17 00:00:00 2001 From: Siwa12100 Date: Fri, 13 Jan 2023 16:17:13 +0100 Subject: [PATCH 12/19] mise a jour affichage de candidats --- header/sae.h | 4 +- source/sae.c | 144 ++++++++++++++++++++++++++------------------------- 2 files changed, 76 insertions(+), 72 deletions(-) diff --git a/header/sae.h b/header/sae.h index 32b4604..efeafb7 100644 --- a/header/sae.h +++ b/header/sae.h @@ -131,8 +131,8 @@ void afficheNbPlacesDep(VilleIut *tiut[], int nbVilles, char nomDept[]); int existeVille( VilleIut *tiut[], char ville[], int nbvilles ); void menuAdmin(VilleIut *tiut[], int nbVilles); -void afficherCandidat(Candidat candidat); -void afficherCandidats(Candidat *candidats, int nbCandidats); +void afficherUnCandidat(Candidat candidat); +void afficherCandidats(Candidat **candidats, int nbCandidats); int creerCandid(Candidat tCand[], int nbCandidats); ListeDeptV2 configurationDeptV2( ListeDept ldept ); diff --git a/source/sae.c b/source/sae.c index e20dcf4..535eb96 100644 --- a/source/sae.c +++ b/source/sae.c @@ -701,22 +701,27 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) * @brief Affiche les informations d'un candidat * @param candidat Le candidat à afficher */ -/* void afficherCandidat(Candidat candidat) + void afficherUnCandidat(Candidat candidat) { - printf("Numéro du candidat : %d\n", candidat.numero); - printf("Nom : %s\n", candidat.nom); - printf("Prénom : %s\n", candidat.prenom); - printf("Notes : %.2f %.2f %.2f %.2f\n", candidat.notes[0], candidat.notes[1], candidat.notes[2], candidat.notes[3]); - printf("Nombre de choix : %d\n", candidat.nbChoix); - for (int i = 0; i < candidat.nbChoix; i++) + int c = 1; + printf("Candidat numero %7d ", candidat.numero); + printf(" | Nom : %10s | ", candidat.nom); + printf(" Prenom : %10s | ", candidat.prenom); + printf(" | Notes : %2f %2f %2f %2f | ", candidat.notes[0], candidat.notes[1], candidat.notes[2], candidat.notes[3]); + printf(" Nombre de choix : %d\n\n", candidat.nbChoix); + + printf(" \n Choix du candidat :\n"); + printf( " -------------------\n\n"); + + while ( candidat.lchoix != NULL ) { - printf("Choix %d :\n", i + 1); - printf(" Ville : %s\n", candidat.choix[i].ville); - printf(" Département : %s\n", candidat.choix[i].departement); - printf(" Décision du département : %d\n", candidat.choix[i].decisionDepartement); - printf(" Validation : %d\n", candidat.choix[i].validationCandidat); + printf(" %d.) Iut : %10s ; departement : %10s ; decision Departement : %d ; validation candidat : %d\n", + candidat.lchoix -> ville, candidat.lchoix -> departement, candidat.lchoix -> decisionDepartement, + candidat.lchoix -> validationCandidat); } -} */ + + printf(" \n\n"); +} /** * @brief Affiche la liste des candidats @@ -724,68 +729,67 @@ void menuAdmin(VilleIut **villeIut, int nbVilles) * @param candidats Le tableau de candidats à afficher * @param nbCandidats Le nombre de candidats dans le tableau */ -/*void afficherCandidats(Candidat *candidats, int nbCandidats) +void afficherCandidats(Candidat **candidats, int nbCandidats) { for (int i = 0; i < nbCandidats; i++) - { - printf("\nCandidat %d :\n", i + 1); - afficherCandidat(candidats[i]); - } + printf("\nCandidat numero %8d | Nom : %10s | Prenom : %10s \n", candidats[i] -> numero, + candidats[i] -> nom, candidats[i] -> prenom); } -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 Date: Fri, 13 Jan 2023 16:17:57 +0100 Subject: [PATCH 13/19] fonction creerCandidat finie normalment youpi --- source/sae.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/sae.c b/source/sae.c index b16774f..5911849 100644 --- a/source/sae.c +++ b/source/sae.c @@ -739,6 +739,12 @@ 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; printf("Le numero du candidat entrain d'etre cree est : %d\n", c->numero); printf("Nom du candidat (peut contenir des espaces): "); @@ -750,12 +756,16 @@ int creerCandidat(Candidat *tCand[], int nbCandidats) i=0; while(i<4) { - printf("Rentrez une note : "); + 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(); - c = (Candidat *) malloc (sizeof(Candidat)); tCand[nbCandidats] = c; return nbCandidats + 1; } From 5537943d704d15ec2bbdf078a5d75b2b4699a739 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 16:32:15 +0100 Subject: [PATCH 14/19] fonction creerCandidat + affichage qui marche youpi --- header/sae.h | 8 +------- source/sae.c | 4 +++- source/test.c | 3 ++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/header/sae.h b/header/sae.h index 620b2c1..55fc3e6 100644 --- a/header/sae.h +++ b/header/sae.h @@ -131,15 +131,9 @@ void afficheNbPlacesDep(VilleIut *tiut[], int nbVilles, char nomDept[]); int existeVille( VilleIut *tiut[], char ville[], int nbvilles ); void menuAdmin(VilleIut *tiut[], int nbVilles); -<<<<<<< HEAD -void afficherCandidat(Candidat candidat); -void afficherCandidats(Candidat *candidats, int nbCandidats); -int creerCandidat(Candidat *tCand[], int nbCandidats); -======= void afficherUnCandidat(Candidat candidat); void afficherCandidats(Candidat **candidats, int nbCandidats); -int creerCandid(Candidat tCand[], int nbCandidats); ->>>>>>> bcdeb24491974b30c7e1ad6913f0e3fa2c3be9c3 +int creerCandidat(Candidat *tCand[], int nbCandidats); ListeDeptV2 configurationDeptV2( ListeDept ldept ); diff --git a/source/sae.c b/source/sae.c index af34e03..00e22b6 100644 --- a/source/sae.c +++ b/source/sae.c @@ -732,8 +732,10 @@ 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); + } } @@ -748,7 +750,7 @@ int creerCandidat(Candidat *tCand[], int nbCandidats) printf("Probleme malloc\n"); exit(1); } - c->numero = nbCandidats; + 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); diff --git a/source/test.c b/source/test.c index ece531e..155aeb9 100644 --- a/source/test.c +++ b/source/test.c @@ -41,10 +41,11 @@ void guillaume(void) { Candidat *tCandid[50]; - int nbCandidats=2; + int nbCandidats=0; nbCandidats = creerCandidat(tCandid, nbCandidats); printf("\n%d\n", nbCandidats); + afficherCandidats(tCandid, nbCandidats); } From d233c5c0dff333cf0d07c43cbdb0fb081a876a45 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 16:33:03 +0100 Subject: [PATCH 15/19] fonction creerCandidat + affichage qui marche youpi --- source/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index 184f5ca..08240ef 100644 --- a/source/main.c +++ b/source/main.c @@ -8,7 +8,7 @@ int main(void) // #ifdef _WIN32 // color // #endif - guillaume(); + //guillaume(); //testCharge(); //Globale(); //testJean(); From 73f9f3b4b48684e6efe3e9b90cab08641a75bb25 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 13 Jan 2023 16:43:18 +0100 Subject: [PATCH 16/19] =?UTF-8?q?commentaires=20sur=20la=20fonction=20cr?= =?UTF-8?q?=C3=A9er=20candidat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/sae.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/sae.c b/source/sae.c index 00e22b6..0beb9a8 100644 --- a/source/sae.c +++ b/source/sae.c @@ -738,7 +738,14 @@ void afficherCandidats(Candidat **candidats, int nbCandidats) } } - +/** + * @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; @@ -776,6 +783,8 @@ int creerCandidat(Candidat *tCand[], int nbCandidats) } + + /* ================================================ Partie 3 From ac9945b6b7e2922daa088296badf0a84a6486c04 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 16:55:58 +0100 Subject: [PATCH 17/19] modifierCandidat --- header/sae.h | 7 ++++++- source/candidat.c | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 source/candidat.c diff --git a/header/sae.h b/header/sae.h index efeafb7..cf1b334 100644 --- a/header/sae.h +++ b/header/sae.h @@ -175,4 +175,9 @@ VilleIut * initialiseIut(void); VilleIut * lireIut (FILE * fichier); VilleIut ** chargeIutDon(char nomFichier[], int * nbIut, int * nbMax); VilleIut ** initialiseTabIut(void); -void tailleSupTabIut(VilleIut ** tIut, int *nbMax); \ No newline at end of file +void tailleSupTabIut(VilleIut ** tIut, int *nbMax); + + +// candidat.c + +Candidat *modifierCandidat(Candidat *c); diff --git a/source/candidat.c b/source/candidat.c new file mode 100644 index 0000000..da84179 --- /dev/null +++ b/source/candidat.c @@ -0,0 +1,26 @@ +#include "../header/sae.h" + + +Candidat *modifierCandidat(Candidat *c) +{ + int choix; + printf("Que voulez vous modifier\n1-Le nom\n2-Le Prenom\n3-Les notes\n"); + scanf("%d", &choix); + switch (choix) + { + case 1: + printf("Nom actuel : %s\nVeuillez saisir le nouveau nom\n", c->nom); + fgets(c->nom, 50, stdin); + c->nom[strlen(c->nom) - 1] = '\0'; + break; + case 2: + printf("Prenom actuel : %s\nVeuillez saisir le nouveau prenom\n", c->prenom); + fgets(c->nom, 50, stdin); + c->nom[strlen(c->nom) - 1] = '\0'; + break; + case 3: + printf("Voici les notes actuels : %.2f %.2f %.2f %.2f\nVeuillez saisir les nouvelles notes(note1/note2/note3/note4", c->notes[0], c->notes[1], c->notes[2], c->notes[3]); + scanf("%f/%f/%f/%f", &c->notes[0], &c->notes[1], &c->notes[2], &c->notes[3]); + break; + } +} \ No newline at end of file From 502fe6b13d3f94575aec282c8c53f45a5272813e Mon Sep 17 00:00:00 2001 From: Siwa12100 Date: Fri, 13 Jan 2023 17:02:41 +0100 Subject: [PATCH 18/19] ajout de supprimer candidature ( jean ) --- source/sae.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/source/sae.c b/source/sae.c index 00e22b6..c121dd7 100644 --- a/source/sae.c +++ b/source/sae.c @@ -775,6 +775,44 @@ int creerCandidat(Candidat *tCand[], int nbCandidats) return nbCandidats + 1; } +/** + * @brief Supprime un choix de la liste de choix d'un candidat + * + * @param lchoix la liste de choix à modifier + * @param nbchoix le nombre de choix dans la liste de choix + * + * @return la liste avec le choix en moins + */ +lChoix supprimerCandidature( lChoix l, int * nbchoix) +{ + if ( l == NULL ) + { + printf(" \n --> Le candidat ne possede aucun choix...\n\n"); + return l; + } + + printf("\n Voici les choix du candidat : \n"); + printf( " -----------------------------\n\n"); + int rep = 0, c = 0; + + for( int i = 0; i < *nbchoix; i ++ ) + { + printf(" %d.) Ville : %10s ; Departement : %10s \n",i + 1, l -> ville, l -> departement); + } + + printf(" \n\n --> Quel choix supprimer ? : "); + scanf("%d%*c", &rep); + + while ( c != rep - 1 ) + { + l = l -> suiv; + c = c + 1; + } + + l = supprimerEnTeteC( l ); + *nbchoix = *nbchoix - 1; + return l; +} /* ================================================ From 0bd7f625f4f458deca4131ae799da1a594be6bd2 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 17:04:48 +0100 Subject: [PATCH 19/19] modifierCandidats --- source/candidat.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/candidat.c b/source/candidat.c index da84179..2932cf3 100644 --- a/source/candidat.c +++ b/source/candidat.c @@ -1,6 +1,11 @@ #include "../header/sae.h" +/** + @brief Modifie les informations d'un candidat + @param c Pointeur vers le candidat à modifier + @return Pointeur vers le candidat modifié +*/ Candidat *modifierCandidat(Candidat *c) { int choix; @@ -16,11 +21,12 @@ Candidat *modifierCandidat(Candidat *c) case 2: printf("Prenom actuel : %s\nVeuillez saisir le nouveau prenom\n", c->prenom); fgets(c->nom, 50, stdin); - c->nom[strlen(c->nom) - 1] = '\0'; + c->prenom[strlen(c->prenom) - 1] = '\0'; break; case 3: - printf("Voici les notes actuels : %.2f %.2f %.2f %.2f\nVeuillez saisir les nouvelles notes(note1/note2/note3/note4", c->notes[0], c->notes[1], c->notes[2], c->notes[3]); + printf("Voici les notes actuels : %.2f %.2f %.2f %.2f\nVeuillez saisir les nouvelles notes(note1/note2/note3/note4)", c->notes[0], c->notes[1], c->notes[2], c->notes[3]); scanf("%f/%f/%f/%f", &c->notes[0], &c->notes[1], &c->notes[2], &c->notes[3]); break; } + return c; } \ No newline at end of file