From b7e9cc297a2ee7a2618aa5a5b4d52a2f5f23d2b7 Mon Sep 17 00:00:00 2001 From: Yann CHAMPEAU Date: Thu, 5 Jan 2023 12:00:59 +0100 Subject: [PATCH 1/3] =?UTF-8?q?R=C3=A9glages=20de=20probl=C3=A8mes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/annexe/saeAnnexe.c | 5 +--- src/partie1/saeP1.c | 56 +++++++++++++++++++++++------------------- src/partie2/saeP2.c | 4 +-- src/partie2/saeP2.h | 4 +-- src/saeMain.c | 2 -- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/annexe/saeAnnexe.c b/src/annexe/saeAnnexe.c index 562757e..56c7391 100644 --- a/src/annexe/saeAnnexe.c +++ b/src/annexe/saeAnnexe.c @@ -60,16 +60,13 @@ int loadIUT(VilleIUT** tiut){ } int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){ - printf("CPT1\n"); - /* if(!lTab){ fprintf(stderr,"Erreur, Pas de villes enregistrées !\n"); return -1; } for(int i=0; iVille==mot) return i; + if(!strcmp(tab[i]->Ville,mot)) return i; } - */ return -1; } diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 8cabde3..f404693 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -12,8 +12,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi) { int quit=0; while(!quit) - { - int intUserEntry=0; + { printf("#--------------------------------------------------------------------#\n"); printf("| |\n"); printf("| SAE S1.02 |\n"); @@ -26,6 +25,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi) printf("4 : Rechercher les IUTs possèdant un département précis.\n"); printf("9 : Revenir à l'écran de sélection du profil.\n\n"); printf("#--------------------------------------------------------------------#\n\n"); + printf("Choisissez l'action que vous voulez exécuter : "); int act; scanf("%d",&act); switch(act){ @@ -47,7 +47,7 @@ void menuUser(VilleIUT* lvIUT[],int tlogi) break; case 9: quit=1; - break; + reset(); } } @@ -55,14 +55,14 @@ void menuUser(VilleIUT* lvIUT[],int tlogi) void SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi) { - for (int i=0;iVille); + for (int i=0;iVille); } void DepEachIUT(VilleIUT* lvIUT[], int tlogi) { for (int i=0;iVille); + printf("\n - %s :",lvIUT[i]->Ville); MaillonDep* MaillonAct=lvIUT[i]->ldept; while (MaillonAct!=NULL) printf("\t-%s\n",MaillonAct->departement); } @@ -209,30 +209,38 @@ void creerDep(VilleIUT* tiut[],int tlogi){ scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; int noVille=rechercheIUT(tiut,tlogi,ville); - if(noVille<=0){ + if(noVille<0){ fprintf(stderr,"\nVille non existante !\n"); return; } VilleIUT* v=tiut[noVille]; - MaillonDep* m=v->ldept; - while(m->suivant!=NULL) m=m->suivant; - m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep)); - if(m->suivant==NULL){ - perror("malloc"); - exit(errno); + int ck=0; + if(v->ldept==NULL){ + ck=1; + v->ldept=(MaillonDep*)malloc(sizeof(MaillonDep)); + if(v->ldept==NULL){ + perror("malloc"); + exit(errno); + } } - m=m->suivant; - printf("\n\nEntrez le nom du département à créer :"); - char dep[31]; - scanf("%*c%s",dep); - strcpy(m->departement,dep); - printf("\n\nEntrez le nombre de places disponibles dans le département :"); + MaillonDep* m=v->ldept; + if(!ck){ + while(m->suivant!=NULL) m=m->suivant; + m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep)); + if(m->suivant==NULL){ + perror("malloc"); + exit(errno); + } + m=m->suivant; + } + printf("\n\nEntrez le nom du département à créer : "); + scanf("%*c%s",m->departement); + printf("\n\nEntrez le nombre de places disponibles dans le département : "); scanf("%d",&m->nbp); - printf("\n\nEntrez le nom du responsable de département :"); - char resp[51]; - scanf("%*c%s",resp); - strcpy(m->resp,resp); - printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",dep,ville); + printf("\n\nEntrez le nom du responsable de département : \n"); + scanf("%*c"); + fgets(m->resp, 51, stdin); + printf("\n\nLe département %s a bien été ajouté à l'IUT de %s.\n",m->departement,ville); return; } @@ -311,9 +319,7 @@ void creerIUT(VilleIUT* tiut[],int* tlogi){ char ville[31]; scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; - fprintf(stderr,"before !\n"); int noVille=rechercheIUT(tiut,*tlogi,ville); - fprintf(stderr,"end !\n"); if(noVille>0){ fprintf(stderr,"\nVille déjà existante !\n"); return; diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index 7dfa7dc..e116ef9 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -3,7 +3,7 @@ #include #include "saeP2.h" -candidat* LoadCandid(void) +/*candidat* LoadCandid(void) { //J'ouvre le fichier FILE* file; @@ -63,7 +63,7 @@ candidat* LoadCandid(void) //Je sors en disant que le load est sucessful printf("Chargement réussie."); return Listecandidat; -} +}*/ /* void RechercheCandidat(int ID, int nbcandidat, int tmax,candidat *tcand) { diff --git a/src/partie2/saeP2.h b/src/partie2/saeP2.h index 527fa4a..bfd7647 100644 --- a/src/partie2/saeP2.h +++ b/src/partie2/saeP2.h @@ -1,5 +1,5 @@ -typedef struct +/*typedef struct { char ville[31]; char dep[31]; @@ -18,4 +18,4 @@ typedef struct candidat* LoadCandid(void); -//void gestionPhaseCandidatures(); A FAIRE. +//void gestionPhaseCandidatures(); A FAIRE.*/ diff --git a/src/saeMain.c b/src/saeMain.c index a9d7a49..be0c401 100644 --- a/src/saeMain.c +++ b/src/saeMain.c @@ -20,12 +20,10 @@ int main(void) case 'C': reset(); menuUser(tiut,tlogi); - reset(); break; case 'A': reset(); menuAdmin(tiut,&tlogi); - reset(); break; case 'Q': printf("Êtes-vous sûr de vouloir quitter ? (Y pour continuer)\n\n"); From 81eecfb1dc332293c73ce71d38826f532dbf8326 Mon Sep 17 00:00:00 2001 From: Jade VAN BRABANDT Date: Thu, 5 Jan 2023 12:04:16 +0100 Subject: [PATCH 2/3] Ignore de l'exe --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ec70424..de7816f 100644 --- a/.gitignore +++ b/.gitignore @@ -59,11 +59,15 @@ dkms.conf .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* +# Executables +.SAE + # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd From 3dec73e60a6b7a84832ad6474a6bc04cf6529371 Mon Sep 17 00:00:00 2001 From: Yann CHAMPEAU Date: Thu, 5 Jan 2023 12:10:12 +0100 Subject: [PATCH 3/3] Fix pcq l'autre la elle sait pas faire des gitignore --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index de7816f..ef51d06 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ *.i*86 *.x86_64 *.hex +SAE # Debug files *.dSYM/ @@ -65,9 +66,6 @@ Icon # Thumbnails ._* -# Executables -.SAE - # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd