From 9ea8c27836a09a5a3b4a35ce00edf00b5a11cdc6 Mon Sep 17 00:00:00 2001 From: Yann CHAMPEAU Date: Wed, 4 Jan 2023 09:56:49 +0100 Subject: [PATCH] =?UTF-8?q?Rien=20n'a=20avanc=C3=A9=20:=5F).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 3 +- SAE | Bin 0 -> 26608 bytes src/Makefile | 16 ++--- src/annexe/Makefile | 4 ++ src/annexe/saeAnnexe.c | 7 +- src/annexe/saeAnnexe.h | 4 +- src/partie1/saeP1.c | 158 +++++++++++++++++++++++++---------------- src/partie1/saeP1.h | 6 +- src/saeMain.c | 2 +- 9 files changed, 121 insertions(+), 79 deletions(-) create mode 100755 SAE diff --git a/Makefile b/Makefile index 83674d5..3b48226 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -PHONY : clean doc all +.PHONY: clean doc all + all : prog EXE prog : diff --git a/SAE b/SAE new file mode 100755 index 0000000000000000000000000000000000000000..23d6b812c0ba5673b66677a9289144000e7d48ba GIT binary patch literal 26608 zcmeHQdw5jUwckm2ga}DgP!yG;fZ~H8pdb%Z6Ue}D4GtNRZ@mmB(cV3bIncNpk(ED%(!D2+}6jc5spU`Kw z)aQg%pixnfc&XI9p9oTYNjY!!fP-a!3M#n;kRv<)*`nOOQ1+M0FTOd z{wd%!8>eVc|GnwCFb95l4*cRAcvlYmtvT?wPCjj#rP7i zX3X?XbX{)NCb}ju@0`VRz356`5kgO~#dBwdqY-_ve|cDk$`uXKh*aqnti3YQ8llxe z-`)SIb^*sJ9$G*7>^^X-^?rINgsCrJk4Rkd%+Mg>-X`43R9-awEGM^9<~@aPk=LV5 zJ|U>^s(sKa@U(VmU8~Y&!J}id7#93VCYG^I3*H)MT^2mWtSTx_=-NVgLY3h@Q5y(A zYg!e}Cu)Qzuc|WECu)ROIhHVGKKf>i@cjD4TZ~Qdi3;JZdAP!YCz>iApQsT|`HnC( zKKd5=i$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b/src/Makefile @@ -1,13 +1,13 @@ -all : saeMain.o lib +.PHONY : all doc clean lib -.PHONY : all doc clean +all : saeMain.o lib -lib : annexe/saeAnnexe.o partie1/saeP1.o partie2/saeP2.o partie3/saeP3.o partie4/saeP4.o - make -C annexe all - make -C partie1 all - make -C partie2 all - make -C partie3 all - make -C partie4 all +lib : + make -C annexe + make -C partie1 + make -C partie2 + make -C partie3 + make -C partie4 saeMain.o : saeMain.c gcc -Wall -c saeMain.c diff --git a/src/annexe/Makefile b/src/annexe/Makefile index 6f41ebb..b9bd736 100644 --- a/src/annexe/Makefile +++ b/src/annexe/Makefile @@ -1,3 +1,7 @@ + +CC = gcc +CCOPTS = -Wall + all : saeAnnexe.o saeAnnexe.o : saeAnnexe.c saeAnnexe.h diff --git a/src/annexe/saeAnnexe.c b/src/annexe/saeAnnexe.c index 4641c10..562757e 100644 --- a/src/annexe/saeAnnexe.c +++ b/src/annexe/saeAnnexe.c @@ -59,14 +59,17 @@ int loadIUT(VilleIUT** tiut){ return tlogi; } -int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot){ +int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]){ + printf("CPT1\n"); + /* if(!lTab){ - fprintf(stderr,"Erreur, Pas d'éléments dans le tableau !"); + fprintf(stderr,"Erreur, Pas de villes enregistrées !\n"); return -1; } for(int i=0; iVille==mot) return i; } + */ return -1; } diff --git a/src/annexe/saeAnnexe.h b/src/annexe/saeAnnexe.h index 3ea8b4c..19aa4c4 100644 --- a/src/annexe/saeAnnexe.h +++ b/src/annexe/saeAnnexe.h @@ -31,7 +31,7 @@ void menu(void); // // int loadIUT(VilleIUT** tiut); //Fichier Binaire. // // -int rechercheTabPtVilleIUT(VilleIUT* tab[],int lTab,char* mot); // +int rechercheIUT(VilleIUT* tab[],int lTab,char mot[]); // // // // @@ -70,4 +70,4 @@ void vider_file(File f); // // // // void reset(void); // -//--------------------------------------------------------------// \ No newline at end of file +//--------------------------------------------------------------// diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 405d46a..fae75c1 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -106,59 +106,64 @@ void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi) //Partie Administrateur. -void menuAdmin(VilleIUT* tiut[],int tlogi){ - int quit=0; - while(!quit){ - printf("#--------------------------------------------------------------------#\n"); - printf("| |\n"); - printf("| SAE S1.02 |\n"); - printf("| |\n"); - printf("#--------------------------------------------------------------------#\n\n"); - printf("Codes correspondant aux différentes actions :\n\n"); - printf("1 : Modifier le nombre de places dans un département.\n"); - printf("2 : Créer un département dans un IUT.\n"); - printf("3 : Supprimer un département d’un IUT.\n"); - printf("4 : Lancer et arrêter la phase de candidature.\n"); - printf("5 : Modifier le nom d'un responsable de département.\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){ - case 1: - modifPlaces(tiut,tlogi); - reset(); - break; - case 2: - creerDep(tiut,tlogi); - reset(); - break; - case 3: - supprimerDep(tiut,tlogi); - reset(); - break; - case 4: - //gestionPhaseCandidatures(); A Faire (Partie 2). - reset(); - break; - case 5: - modifNomResponsable(tiut,tlogi); - reset(); - break; - case 9: - quit=1; - reset(); - } - } +void menuAdmin(VilleIUT* tiut[],int *tlogi){ + int quit=0; + while(!quit){ + printf("#--------------------------------------------------------------------#\n"); + printf("| |\n"); + printf("| SAE S1.02 |\n"); + printf("| |\n"); + printf("#--------------------------------------------------------------------#\n\n"); + printf("Codes correspondant aux différentes actions :\n\n"); + printf("1 : Modifier le nombre de places dans un département.\n"); + printf("2 : Créer un département dans un IUT.\n"); + printf("3 : Supprimer un département d’un IUT.\n"); + printf("4 : Lancer et arrêter la phase de candidature.\n"); + printf("5 : Modifier le nom d'un responsable de département.\n"); + printf("6 : Créer un IUT.\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){ + case 1: + modifPlaces(tiut,*tlogi); + reset(); + break; + case 2: + creerDep(tiut,*tlogi); + reset(); + break; + case 3: + supprimerDep(tiut,*tlogi); + reset(); + break; + case 4: + //gestionPhaseCandidatures(); A Faire (Partie 2). + reset(); + break; + case 5: + modifNomResponsable(tiut,*tlogi); + reset(); + break; + case 6: + creerIUT(tiut,tlogi); + reset(); + break; + case 9: + quit=1; + reset(); + } + } } void modifPlaces(VilleIUT* tiut[],int tlogi){ - printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); + printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",&ville); + scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; - int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville); + int noVille=rechercheIUT(tiut,tlogi,ville); if(noVille<=0){ fprintf(stderr,"\nVille non existante !\n"); return; @@ -166,7 +171,7 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){ VilleIUT* v=tiut[noVille]; printf("\n\nEntrez le département à modifier:"); char dep[31]; - scanf("%*c%s",&dep); + scanf("%*c%s",dep); if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; @@ -182,11 +187,11 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){ } void creerDep(VilleIUT* tiut[],int tlogi){ - printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); + printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",&ville); + scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; - int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville); + int noVille=rechercheIUT(tiut,tlogi,ville); if(noVille<=0){ fprintf(stderr,"\nVille non existante !\n"); return; @@ -202,24 +207,24 @@ void creerDep(VilleIUT* tiut[],int tlogi){ m=m->suivant; printf("\n\nEntrez le nom du département à créer :"); char dep[31]; - scanf("%*c%s",&dep); + scanf("%*c%s",dep); strcpy(m->departement,dep); 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); + 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); return; } void supprimerDep(VilleIUT* tiut[],int tlogi){ - printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); + printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",&ville); + scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; - int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville); + int noVille=rechercheIUT(tiut,tlogi,ville); if(noVille<=0){ fprintf(stderr,"\nVille non existante !\n"); return; @@ -227,7 +232,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){ VilleIUT* v=tiut[noVille]; printf("\n\nEntrez le département à supprimer:"); char dep[31]; - scanf("%*c%s",&dep); + scanf("%*c%s",dep); if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; @@ -236,6 +241,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){ if(m->departement==dep){ printf("\n\nVoulez-vous supprimer le département %s de la ville de %s ? (Y pour continuer)\n\n",m->departement,v->Ville); char choix; + scanf("%*c%c",&choix); if(choix!='Y') return; v->ldept=m->suivant; free(m); @@ -244,6 +250,7 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){ while(m->suivant->departement!=dep) m=m->suivant; printf("\n\nVoulez-vous supprimer le département %s de la ville de %s ? (Y pour continuer)\n\n",m->suivant->departement,v->Ville); char choix; + scanf("%*c%c",&choix); if(choix!='Y') return; MaillonDep* temp; temp=m->suivant; @@ -255,11 +262,11 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){ } void modifNomResponsable(VilleIUT* tiut[],int tlogi){ - printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); + printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner): "); char ville[31]; - scanf("%*c%s",&ville); + scanf("%*c%s",ville); if(ville[0]=='Q' && ville[1]=='\0') return; - int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville); + int noVille=rechercheIUT(tiut,tlogi,ville); if(noVille<=0){ fprintf(stderr,"\nVille non existante !\n"); return; @@ -267,7 +274,7 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){ VilleIUT* v=tiut[noVille]; printf("\n\nEntrez le département à modifier:"); char dep[31]; - scanf("%*c%s",&dep); + scanf("%*c%s",dep); if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return; @@ -276,8 +283,33 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){ while(m->departement!=dep) m=m->suivant; printf("\n\nLe responsable du département %s de l'IUT de la ville de %s est actuellement %s. Quel est le nom du nouveau responsable ?\n\n",m->departement,v->Ville,m->resp); char nom[51]; - scanf("%d",&nom); + scanf("%s",nom); strcpy(m->resp,nom); printf("\n\nLe nom du responsable du département %s de l'IUT de %s a bien été changé pour %s.\n",dep,ville,nom); return; } + +void creerIUT(VilleIUT* tiut[],int* tlogi){ + printf("\nEntrez le nom de la ville correspondant à l'IUT à ajouter (Q pour abandonner): "); + 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; + } + VilleIUT* v=(VilleIUT*)malloc(sizeof(VilleIUT)); + if(v==NULL){ + perror("malloc"); + exit(errno); + } + strcpy(v->Ville,ville); + v->ldept=NULL; + tiut[*tlogi]=v; + *tlogi=*tlogi+1; + printf("\n\nL'IUT de %s a bien été ajouté.\n",ville); + return; +} diff --git a/src/partie1/saeP1.h b/src/partie1/saeP1.h index d52d2d6..84f282c 100644 --- a/src/partie1/saeP1.h +++ b/src/partie1/saeP1.h @@ -28,7 +28,7 @@ void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi); //Admin -void menuAdmin(VilleIUT* tiut[],int tlogi); +void menuAdmin(VilleIUT* tiut[],int* tlogi); void modifPlaces(VilleIUT* tiut[],int tlogi); @@ -36,4 +36,6 @@ void creerDep(VilleIUT* tiut[],int tlogi); void supprimerDep(VilleIUT* tiut[],int tlogi); -void modifNomResponsable(VilleIUT* tiut[],int tlogi); \ No newline at end of file +void modifNomResponsable(VilleIUT* tiut[],int tlogi); + +void creerIUT(VilleIUT* tiut[],int* tlogi); diff --git a/src/saeMain.c b/src/saeMain.c index 0afd953..a9d7a49 100644 --- a/src/saeMain.c +++ b/src/saeMain.c @@ -24,7 +24,7 @@ int main(void) break; case 'A': reset(); - menuAdmin(tiut,tlogi); + menuAdmin(tiut,&tlogi); reset(); break; case 'Q':