From ac9945b6b7e2922daa088296badf0a84a6486c04 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 16:55:58 +0100 Subject: [PATCH 01/11] 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 02/11] 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 03/11] 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 From 8c7e531a2b4ef9cd68fe8029a235696a169e2a24 Mon Sep 17 00:00:00 2001 From: DahmaneYanis Date: Fri, 13 Jan 2023 17:05:00 +0100 Subject: [PATCH 04/11] =?UTF-8?q?Fonction=20de=20chargement=20termin=C3=A9?= =?UTF-8?q?=20-=20Non=20comment=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chargEtSauvFich.c | 50 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/source/chargEtSauvFich.c b/source/chargEtSauvFich.c index 43712d3..97483a2 100644 --- a/source/chargEtSauvFich.c +++ b/source/chargEtSauvFich.c @@ -169,6 +169,7 @@ void lectureDep(ListeDept ldept, FILE * fichier) fscanf(fichier, "%s %d ", ldept->nomDept, &ldept->nbP); fgets(ldept->resp, 30, fichier); ldept->resp[strlen(ldept->resp)-1] = '\0'; + ldept->suiv = NULL; } /** @@ -178,14 +179,61 @@ void testCharge(void) { int nbIut, nbMax; VilleIut ** tIut = chargeIutDon("../donnees/iut.don", &nbIut, &nbMax); + fusionIut(tIut, &nbIut); for (int i = 0; i < nbIut; i++) { - printf("[ %s | %s | %d | %s ]\n", tIut[i]->nom, tIut[i]->lDept->nomDept, tIut[i]->lDept->nbP, tIut[i]->lDept->resp); + printf("\nVille : %s\n", tIut[i]->nom); + afficherListe(tIut[i]->lDept); } } +void fusionIut(VilleIut ** tIut, int *nbIut) +{ + int indice; + + for (int i = 0; i < *nbIut; i++) + { + if(existe(tIut[i]->nom, tIut, *nbIut, i, &indice)) + { + fusion(tIut, *nbIut, i, indice); + (*nbIut)--; + i--; + } + } +} +int existe(char * nom, VilleIut ** tIut, int nbIut, int iDepart, int * indice) +{ + for (int i = iDepart+1; i < nbIut; i++) + { + if (strcmp(nom, tIut[i]->nom) == 0) + { + *indice = i; + return 1; + } + } + + return 0; +} + +void fusion(VilleIut ** tIut, int nbIut, int i, int j) +{ + ListeDept aux; + aux = tIut[i]->lDept; + tIut[i]->lDept = tIut[j]->lDept; + tIut[i]->lDept->suiv = aux; + + supprimerIut(tIut, nbIut, j); +} + +void supprimerIut(VilleIut ** tIut, int nbIut, int j) +{ + for (int i = j ; i < nbIut-1 ; i++) + { + tIut[i] = tIut[i+1]; + } +} /*int chargIutDon(VilleIut *tVilleIut[], int nbMax, char nomFich[]) { From 0972ffda5385ee78054bb23f69137568d4f47fdc Mon Sep 17 00:00:00 2001 From: DahmaneYanis Date: Fri, 13 Jan 2023 17:05:47 +0100 Subject: [PATCH 05/11] modif sae.h --- header/sae.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/header/sae.h b/header/sae.h index a11c0c7..51bef55 100644 --- a/header/sae.h +++ b/header/sae.h @@ -169,4 +169,8 @@ 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); +void fusionIut(VilleIut ** tIut, int * nbIut); +int existe(char * nom, VilleIut ** tIut, int nbIut, int iDepart, int * indice); +void fusion(VilleIut ** tIut, int nbIut, int i, int j); +void supprimerIut(VilleIut ** tIut, int nbIut, int j); \ No newline at end of file From 12ab40ad39e6049b0c5cf250d94b5210c6e68b93 Mon Sep 17 00:00:00 2001 From: DahmaneYanis Date: Fri, 13 Jan 2023 17:08:40 +0100 Subject: [PATCH 06/11] fonction vitrine --- source/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index 08240ef..c9eaef0 100644 --- a/source/main.c +++ b/source/main.c @@ -9,7 +9,7 @@ int main(void) // color // #endif //guillaume(); - //testCharge(); + testCharge(); //Globale(); //testJean(); return 0; From 180d2991db4d352e67187c2ea39ffe0ad0ceec48 Mon Sep 17 00:00:00 2001 From: loris OBRY Date: Fri, 13 Jan 2023 17:09:11 +0100 Subject: [PATCH 07/11] Changement organisation des fonctions --- header/sae.h | 8 ++-- source/sae.c | 104 --------------------------------------------------- 2 files changed, 4 insertions(+), 108 deletions(-) diff --git a/header/sae.h b/header/sae.h index b5cfcad..3e506df 100644 --- a/header/sae.h +++ b/header/sae.h @@ -137,10 +137,6 @@ int creerCandidat(Candidat *tCand[], int nbCandidats); ListeDeptV2 configurationDeptV2( ListeDept ldept ); -void affichageListesDept( ListeCandidats lcand, char * type, char * nomDept ); -ListeCandidats trierListeCandidats( ListeCandidats l ); -ListeCandidats insertionCroissanteCand( ListeCandidats nvL, ListeCandidats l ); -ListeCandidats insertionTeteCand( ListeCandidats nvL, ListeCandidats l ); // listeDeparements.c ListeDept ajouterEnTete(ListeDept ldept, char nomDept[], char resp[], int nbP); @@ -181,3 +177,7 @@ void tailleSupTabIut(VilleIut ** tIut, int *nbMax); // candidat.c Candidat *modifierCandidat(Candidat *c); +void affichageListesDept( ListeCandidats lcand, char * type, char * nomDept ); +ListeCandidats trierListeCandidats( ListeCandidats l ); +ListeCandidats insertionCroissanteCand( ListeCandidats nvL, ListeCandidats l ); +ListeCandidats insertionTeteCand( ListeCandidats nvL, ListeCandidats l ); diff --git a/source/sae.c b/source/sae.c index 9dd1488..b4cf500 100644 --- a/source/sae.c +++ b/source/sae.c @@ -882,108 +882,4 @@ ListeDeptV2 configurationDeptV2( ListeDept ldept ) } return lDeptV2; -} - -/* -================================================ - Partie 4 -================================================ -*/ - -/** - * @brief Affiche une liste de candidats après l'avoir triée par ordre alphabétique - * - * @param lcand liste de candidats à trier et afficher - * @param type type de liste à afficher ( en attente ou admis ) - * @param nomDept nom du departement dont est issu la liste - */ -void affichageListesDept( ListeCandidats lcand, char * type, char * nomDept ) -{ - lcand = trierListeCandidats( lcand ); - - printf( " Liste des candidats %s du departement %10s \n -------------------------------------------------------\n\n", type, nomDept); - - while ( lcand != NULL) - { - printf(" | Nom : %10s | Prenom : %10s | Numero : %8s |\n", - lcand -> candidat.nom, lcand -> candidat.prenom, lcand -> candidat.numero); - - lcand = lcand -> suiv; - } -} -/** - * @brief Trie par ordre alphabétique les candidats d'une liste - * - * @param l liste de candidats à trier. - * - * @return La liste triée - */ -ListeCandidats trierListeCandidats( ListeCandidats l ) -{ - ListeCandidats nvL; - - while ( l != NULL ) - { - nvL = insertionCroissanteCand( nvL, l ); - l = l -> suiv; - } - - return nvL; -} - -/** - * @brief Permet d'insérer un nouveau Maillon de candidats dans la liste par ordre alphabétique - * @param l la liste dont est issu le maillon à insérer - * @param nvL la nouvelle liste où est inséré le maillon - * - * @return La nouvelle liste avec le maillon au bon endroit - */ -ListeCandidats insertionCroissanteCand( ListeCandidats nvL, ListeCandidats l ) -{ - if ( l == NULL) - { - nvL = insertionTeteCand( nvL, l ); - return nvL; - } - - if ( strcmp( l -> candidat.nom, nvL -> candidat.nom ) < 0 ) - { - nvL = insertionTeteCand( nvL, l ); - return nvL; - } - - if ( strcmp( l -> candidat.nom, nvL -> candidat.nom ) == 0 ) - { - if ( strcmp( l -> candidat.prenom, nvL -> candidat.prenom ) < 0 ) - { - nvL = insertionTeteCand( nvL, l ); - return nvL; - } - } - - nvL -> suiv = insertionCroissanteCand( nvL -> suiv, l ); - return nvL; -} - -/** - * @brief Insère en tête de la nouvelle liste un nouveau maillon - * @param l liste d'où est issu le nouveau maillon à intégrer - * @param nvL Liste où est insérer le nouveau Maillon - * @return La nouvelle liste avec le maillon au bon endroit - */ -ListeCandidats insertionTeteCand( ListeCandidats nvL, ListeCandidats l ) -{ - MaillonCandidat * m = ( MaillonCandidat * ) malloc ( sizeof( MaillonCandidat )); - if ( m == NULL ) - { - printf("\n -> Erreur allocation memoire...\n"); - exit(1); - } - - m -> candidat = l -> candidat; - m -> suiv = nvL; - nvL = m; - free( l ); - - return nvL; } \ No newline at end of file From 8c5ff507e8d96c38ff195540e138606cd2e51d35 Mon Sep 17 00:00:00 2001 From: DahmaneYanis Date: Fri, 13 Jan 2023 17:29:13 +0100 Subject: [PATCH 08/11] =?UTF-8?q?Fonction=20chargement=20comment=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chargEtSauvFich.c | 140 +++++++++------------------------------ 1 file changed, 33 insertions(+), 107 deletions(-) diff --git a/source/chargEtSauvFich.c b/source/chargEtSauvFich.c index 97483a2..fbf487d 100644 --- a/source/chargEtSauvFich.c +++ b/source/chargEtSauvFich.c @@ -42,6 +42,7 @@ VilleIut ** chargeIutDon(char nomFichier[], int * nbIut, int * nbMax) } *nbIut = i-1; + fclose(fichier); return tIut; } @@ -188,6 +189,12 @@ void testCharge(void) } } +/** + * @brief Fusionne la liste de département de toutes les villes du même nom de tIut + * + * @param tIut Tableau de pointeur de VilleIut + * @param nbIut [Taille Logique] + */ void fusionIut(VilleIut ** tIut, int *nbIut) { int indice; @@ -203,6 +210,16 @@ void fusionIut(VilleIut ** tIut, int *nbIut) } } +/** + * @brief Verifie l'existance d'une VilleIut dans le tableau de pointeur de VilleIut + * + * @param nom [CHAINE DE CARACTERES] + * @param tIut Tableau de pointeur de VilleIut + * @param nbIut [Taille Logique] + * @param iDepart Indice à partir du quel rechercher + * @param indice Indice de la valeur si trouvée + * @return int 1 -> Trouvé | 0 -> Inexistante + */ int existe(char * nom, VilleIut ** tIut, int nbIut, int iDepart, int * indice) { for (int i = iDepart+1; i < nbIut; i++) @@ -217,6 +234,14 @@ int existe(char * nom, VilleIut ** tIut, int nbIut, int iDepart, int * indice) return 0; } +/** + * @brief Fusionne la liste de département de deux VilleIut du même nom + * + * @param tIut Tableau de pointeur de VilleIut + * @param nbIut [Taille Logique] + * @param i Indice liste d'accueil + * @param j Indice ville à supprimer + */ void fusion(VilleIut ** tIut, int nbIut, int i, int j) { ListeDept aux; @@ -227,116 +252,17 @@ void fusion(VilleIut ** tIut, int nbIut, int i, int j) supprimerIut(tIut, nbIut, j); } +/** + * @brief Supprime une ville du tableau de pointeur de VilleIut + * + * @param tIut Tableau de pointeur de VilleIut + * @param nbIut [Taille Logique] + * @param j Indice ville à supprimer + */ void supprimerIut(VilleIut ** tIut, int nbIut, int j) { for (int i = j ; i < nbIut-1 ; i++) { tIut[i] = tIut[i+1]; } -} - -/*int chargIutDon(VilleIut *tVilleIut[], int nbMax, char nomFich[]) -{ - FILE *flot; - int i=0, nbP, trouve, indice; - char nom[30], nomDept[30], resp[30]; - - flot = fopen(nomFich, "r"); - if(flot==NULL) - { - printf("Probleme d'ouverture du fichier\n"); - exit(1); - } - fscanf(flot, "%s", nom); - lireDep(flot, nomDept, &nbP, resp); - while(!feof(flot)) - { - if(i==nbMax) - { - printf("Tableau plein\n"); - return -1; - } - indice = appartientIut(tVilleIut, i, nom, &trouve); - if(trouve==0) - { - tVilleIut[i] = (VilleIut*)malloc(sizeof(VilleIut)); - if(tVilleIut[i]==NULL) - { - printf("Probleme malloc\n"); - fclose(flot); - exit(1); - } - strcpy(tVilleIut[i]->nom, nom); - tVilleIut[i]->lDept = listenouv(); - ajouterDept(tVilleIut[i]->lDept, nomDept, resp, nbP); - i = i + 1; - } - if(trouve==1) - tVilleIut[indice]->lDept = ajouterDept(tVilleIut[indice]->lDept, nomDept, resp, nbP); - fscanf(flot, "%s", nom); - lireDep(flot, nomDept, &nbP, resp); - } - return i; -} - -void lireDep(FILE *flot, char nomDept[], int *nbP, char resp[]) -{ - fscanf(flot,"%s%d\t", nomDept, nbP); - fgets(resp, 30, flot); - - #ifdef _WIN32 - resp[strlen(resp) - 1] = '\0'; - #endif - - #ifdef __linux__ - resp[strlen(resp) - 2] = '\0'; - #endif -} - -int appartientIut(VilleIut *tVilleIut[], int nb, char nom[], int *trouve) -{ - int i = 0; - - while(i < nb) - { - if(strcmp(tVilleIut[i]->nom, nom) == 0) - { - *trouve = 1; - return i; - } - i = i + 1; - } - *trouve = 0; - return i; -} - -void sauvegarderFichierIutDon(VilleIut *tVilleIut[], int nbVille, char nomFich[]) -{ - FILE *flot; - int i=0; - - flot = fopen(nomFich, "w"); - if(flot==NULL) - { - printf("Probleme lors de l'ouverture du fichier\n"); - exit(1); - } - while(ilDept != NULL) - { - printf("%s %s %d %s", tVilleIut[i]->nom, tVilleIut[i]->lDept->nomDept, tVilleIut[i]->lDept->nbP, tVilleIut[i]->lDept->resp); - fprintf(flot, "%s %s %d %s", tVilleIut[i]->nom, tVilleIut[i]->lDept->nomDept, tVilleIut[i]->lDept->nbP, tVilleIut[i]->lDept->resp); - tVilleIut[i]->lDept = tVilleIut[i]->lDept->suiv; - } - i = i + 1; - } - fclose(flot); -} - -*/ - -/* - -*/ \ No newline at end of file +} \ No newline at end of file From 26b168e25342f7d560d8b609e7369f3fc33ffda4 Mon Sep 17 00:00:00 2001 From: DahmaneYanis Date: Fri, 13 Jan 2023 17:47:27 +0100 Subject: [PATCH 09/11] Mise en place 1) menu visiteur - Fonction de chargement utilisable dans globale --- source/chargEtSauvFich.c | 2 ++ source/main.c | 4 ++-- source/sae.c | 25 +++++++++++++++++-------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/source/chargEtSauvFich.c b/source/chargEtSauvFich.c index fbf487d..a64acc3 100644 --- a/source/chargEtSauvFich.c +++ b/source/chargEtSauvFich.c @@ -43,6 +43,8 @@ VilleIut ** chargeIutDon(char nomFichier[], int * nbIut, int * nbMax) *nbIut = i-1; fclose(fichier); + + fusionIut(tIut, nbIut); return tIut; } diff --git a/source/main.c b/source/main.c index c9eaef0..44200a6 100644 --- a/source/main.c +++ b/source/main.c @@ -9,8 +9,8 @@ int main(void) // color // #endif //guillaume(); - testCharge(); - //Globale(); + //testCharge(); + Globale(); //testJean(); return 0; diff --git a/source/sae.c b/source/sae.c index b4cf500..fa822c1 100644 --- a/source/sae.c +++ b/source/sae.c @@ -14,21 +14,25 @@ */ void Globale(void) { - printf(" \n ---> lancement de la fonction globale.... \n\n"); + //printf(" \n ---> lancement de la fonction globale.... \n\n"); Log * tLog; - VilleIut *tIut[50] ; + VilleIut ** tIut; int nbVilles; int nbLog; + int nbIut, nbIutMax; //Chargement des fichiers tLog = chargementLog("../donnees/log.don", &nbLog); + tIut = chargeIutDon("../donnees/iut.don", &nbIut, &nbIutMax); + //nbVilles = chargIutDon(tIut, 50, "../donnees/iut.don"); //Appel du menu visiteur - menuVisiteur(tLog, nbLog, tIut, nbVilles); + menuVisiteur(tLog, nbLog, tIut, nbIut); //Sauvegarde dans les fichiers + } /** @@ -99,7 +103,7 @@ void test(VilleIut * tIut[], int nbVilles) * choixMenuVisiteur. Selon le choix de l'utilisateur, la fonction appelle la fonction correspondante * ou met fin à l'exécution de la fonction. */ -void menuVisiteur(Log * tLog, int nbLog, VilleIut *tIut[], int nbVilles) +void menuVisiteur(Log * tLog, int nbLog, VilleIut *tIut[], int nbIut) //void menuVisiteur(VilleIut *villeIut, int nbVilles) { int choix; @@ -115,14 +119,15 @@ void menuVisiteur(Log * tLog, int nbLog, VilleIut *tIut[], int nbVilles) { case 1: //test(tIut, nbVilles); - afficheVillesIUT(tIut, nbVilles); + afficheVillesIUT(tIut, nbIut); //printf("Affiche les Villes contenant des IUT (En attente d'une fonction de chargement fonctionnelle)\n"); break; case 2: printf("Affiche le nombre de place dans un departement (En attente de Guillaume)\n"); break; case 3 : - afficherDeptIutDonne(tIut, nbVilles); + printf("Afficher departement d'un Iut\n"); + //afficherDeptIutDonne(tIut, nbIut); break; case 4 : printf("Affiche les IUT possedant un departement donne (En attente de Jean)\n"); @@ -581,8 +586,12 @@ void afficheVillesIUT(VilleIut *tiut[], int nbVilles) { // Affichage du nom de la ville printf(" -> %s\n", tiut[i]-> nom); - } - printf(" \n\n\n"); + } + + printf("\nAppuyez sur entree pour continuer...\n"); + scanf("%*c"); + + clean } /** From 6b3702c669627916c9bca2eedbd38b4442fcd345 Mon Sep 17 00:00:00 2001 From: DahmaneYanis Date: Fri, 13 Jan 2023 17:54:59 +0100 Subject: [PATCH 10/11] fichier yanis --- source/sae.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/sae.c b/source/sae.c index fa822c1..37c4030 100644 --- a/source/sae.c +++ b/source/sae.c @@ -118,9 +118,7 @@ void menuVisiteur(Log * tLog, int nbLog, VilleIut *tIut[], int nbIut) switch(choix) { case 1: - //test(tIut, nbVilles); afficheVillesIUT(tIut, nbIut); - //printf("Affiche les Villes contenant des IUT (En attente d'une fonction de chargement fonctionnelle)\n"); break; case 2: printf("Affiche le nombre de place dans un departement (En attente de Guillaume)\n"); From 158922079cc0e27b3a3b38957b52fb53601380d4 Mon Sep 17 00:00:00 2001 From: DahmaneYanis Date: Fri, 13 Jan 2023 18:07:13 +0100 Subject: [PATCH 11/11] =?UTF-8?q?Segmentation=20fault=20corrig=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chargEtSauvFich.c | 3 +++ source/sae.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/chargEtSauvFich.c b/source/chargEtSauvFich.c index a64acc3..f9ff82d 100644 --- a/source/chargEtSauvFich.c +++ b/source/chargEtSauvFich.c @@ -27,6 +27,8 @@ VilleIut ** chargeIutDon(char nomFichier[], int * nbIut, int * nbMax) *nbMax = 5; + + i = 0; while (!feof(fichier)) { @@ -45,6 +47,7 @@ VilleIut ** chargeIutDon(char nomFichier[], int * nbIut, int * nbMax) fclose(fichier); fusionIut(tIut, nbIut); + return tIut; } diff --git a/source/sae.c b/source/sae.c index 37c4030..edb57c4 100644 --- a/source/sae.c +++ b/source/sae.c @@ -81,10 +81,8 @@ Log * chargementLog(char * nomFichier, int * nbLog) } fscanf(fichier, "%s %s %s", tLog[i].utilisateur, tLog[i].mdp, tLog[i].status); - printf("%s\n", tLog[i].status); i++; } - *nbLog = i; return tLog; }