From 1c04d7375a3b0eb06f20c109db97549c63fe69e1 Mon Sep 17 00:00:00 2001 From: Benjamin BACHELARD Date: Thu, 5 Jan 2023 09:34:53 +0100 Subject: [PATCH 1/6] modif admin et iut.h -> changement fonction enfiler et modifnbP --- adminIut.c | 46 +++++++++++++++++++++++++++++++++------------- iut.h | 8 ++++---- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/adminIut.c b/adminIut.c index a930b70..9069626 100644 --- a/adminIut.c +++ b/adminIut.c @@ -5,17 +5,30 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){ char departement[30],respon[30],Vmodif[31]; - int choix,nbp,i,comp; + int choix,nbp,i,comp,Mnbp; VilleIUT V; - printf("\n1-Modifier place\n2-Creer un departement\n3-supprimer un département\n4-Lancer et Arreter la phase de canditature\n5-modifier nom responsable"); - scanf("%d",&choix); + printf("\n1-Modifier place\n2-Creer un departement\n3-supprimer un département\n4-Lancer et Arreter la phase de canditature\n5-modifier nom responsable :"); + scanf("\n%d",&choix); if(choix==1){ - + printf("\nVille où se situe le departement à modifier :"); + scanf("%s",Vmodif); + printf("\ndepartement à modifier:"); + scanf("%s",departement); + printf("\nnombre de place apres modification :"); + scanf("%d",&Mnbp); + + for(i=0;iville, Vmodif); + if(comp==0){ + tiut[i]->ldept=ModifinbP(tiut[i]->ldept,departement,Mnbp,n); + } + } + } if(choix==2){ //creer departemement - printf("\nVille où se situe le departement"); + printf("\nVille où se situe le departement :"); scanf("%s",Vmodif); printf("\ndepartement a creer :"); scanf("%s",departement); @@ -25,14 +38,11 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){ scanf("%s",respon); for(i=0;iville,Vmodif); + comp=strcmp(tiut[i]->ville, Vmodif); if(comp==0){ tiut[i]->ldept=Enfiler(tiut[i]->ldept,departement,nbp,respon); - } - if(comp<0) - printf("error impossible ville inexistante"); + } } - //V=Enfiler(V,departement,nbp,respon); } if(choix==3){ //supprimer departement et pauser condition pour choisir qui suppr @@ -50,7 +60,7 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){ if(choix==5){ //modification responsable } - + affichage(tiut,n); } @@ -69,6 +79,16 @@ ListeD suppression(ListeD ld,char *departement,char *responsable){ return ld; } +ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n){ + int comp,trouv,i; + for(i=0;idepartement,departement); + if(comp==0) + trouv=i; + } + if(trouv==0) + printf("departement non existant"); +} @@ -80,7 +100,7 @@ ListeD Enfiler(ListeD ld, char departement[30], int nbP, char resp[30]) { mN->nbP = nbP; strcpy(mN->resp, resp); mN->suivant = NULL; - + printf("\naa"); if (ld == NULL) { ld = mN; } else { @@ -93,7 +113,7 @@ ListeD Enfiler(ListeD ld, char departement[30], int nbP, char resp[30]) { } return ld; } -for zfzughzguy hzh ubh hgbf + /* VilleIUT defiler(VilleIUT V){ MaillonDept *temp; diff --git a/iut.h b/iut.h index 47ca5e1..1340b10 100644 --- a/iut.h +++ b/iut.h @@ -19,22 +19,22 @@ typedef enum {faux,vrai}Booleen; //Menu utilisateur : void MenuUtilisateur(VilleIUT *tiut[],int n); - int rechercheIUT(VilleIUT *tiut[]); + int rechercheIUT(VilleIUT *tiut[],int n); //Menu administrateur : void MenuAdministrateur(VilleIUT *tiut[],int n); ListeD suppression(ListeD ld,char *departement,char *responsable); ListeD suppressionTete(ListeD ld); - - + ListeD Enfiler(ListeD D, char *departement, int nbP,char *resp); + ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n); //recherche //MaillonDept recherche (MaillonDept *Ville,char *departement,char *responsable); //Liste: VilleIUT Initialisation(void); - ListeD Enfiler(ListeD D, char *departement, int nbP,char *resp); + Booleen testVide(VilleIUT V); void afficher (VilleIUT V); VilleIUT defiler(VilleIUT V); From b7e84da52d92ac23755c8add9b66145addbf9cf1 Mon Sep 17 00:00:00 2001 From: Benjamin BACHELARD Date: Thu, 5 Jan 2023 09:38:53 +0100 Subject: [PATCH 2/6] modif admin et iut.h -> changement fonction enfiler et modifnbP --- adminIut.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/adminIut.c b/adminIut.c index 9069626..f9b0aaf 100644 --- a/adminIut.c +++ b/adminIut.c @@ -86,8 +86,12 @@ ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n){ if(comp==0) trouv=i; } - if(trouv==0) + if(trouv ==0){ printf("departement non existant"); + exit(1); + } + else + } From bbea22b4d2d16c68c299abc1d483381b9bba56a7 Mon Sep 17 00:00:00 2001 From: Benjamin BACHELARD Date: Thu, 5 Jan 2023 09:45:06 +0100 Subject: [PATCH 3/6] =?UTF-8?q?Ajout=20de=20diff=C3=A9rentes=20fonctions,?= =?UTF-8?q?=20et=20modifications=20dans=20adminIut.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminIut.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adminIut.c b/adminIut.c index f9b0aaf..68deb4f 100644 --- a/adminIut.c +++ b/adminIut.c @@ -90,8 +90,10 @@ ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n){ printf("departement non existant"); exit(1); } - else - + else{ + ld[i].nbP=MnbP; + } + return ld; } From ae0b375dbfa27acca5345857f35ca70005cb4abc Mon Sep 17 00:00:00 2001 From: Benjamin BACHELARD Date: Thu, 5 Jan 2023 09:47:04 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Ajout=20de=20diff=C3=A9rentes=20fonctions,?= =?UTF-8?q?=20et=20modifications=20dans=20adminIut.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminIut.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/adminIut.c b/adminIut.c index e69de29..1269ab6 100644 --- a/adminIut.c +++ b/adminIut.c @@ -0,0 +1,140 @@ +#include +#include +#include +#include "iut.h" + +void MenuAdministrateur(VilleIUT *tiut[],int n){ + char departement[30],respon[30],Vmodif[31]; + int choix,nbp,i,comp,Mnbp; + VilleIUT V; + + printf("\n1-Modifier place\n2-Creer un departement\n3-supprimer un département\n4-Lancer et Arreter la phase de canditature\n5-modifier nom responsable :"); + scanf("\n%d",&choix); + if(choix==1){ + printf("\nVille où se situe le departement à modifier :"); + scanf("%s",Vmodif); + printf("\ndepartement à modifier:"); + scanf("%s",departement); + printf("\nnombre de place apres modification :"); + scanf("%d",&Mnbp); + + for(i=0;iville, Vmodif); + if(comp==0){ + tiut[i]->ldept=ModifinbP(tiut[i]->ldept,departement,Mnbp,n); + } + } + + } + if(choix==2){ + //creer departemement + printf("\nVille où se situe le departement :"); + scanf("%s",Vmodif); + printf("\ndepartement a creer :"); + scanf("%s",departement); + printf("\nnombre de place :"); + scanf("%d",&nbp); + printf("\nnom du responsable :"); + scanf("%s",respon); + + for(i=0;iville, Vmodif); + if(comp==0){ + tiut[i]->ldept=Enfiler(tiut[i]->ldept,departement,nbp,respon); + } + } + } + if(choix==3){ + //supprimer departement et pauser condition pour choisir qui suppr + printf("\ndepartement :"); + scanf("%s",departement); + printf("\nresponsable :"); + scanf("%s",respon); + // *resultat=recherche(V.Ville,departement,respon); + //m=suppression(m,departement,respon); + affichage(tiut, n); + } + if(choix==4){ + //Lancer et arreter phase de canditature + } + if(choix==5){ + //modification responsable + } + affichage(tiut,n); +} + + +ListeD suppressionTete(ListeD ld){ + ListeD ldsvt; + ldsvt=ld->suivant; + free(ld); + return ldsvt; + } +ListeD suppression(ListeD ld,char *departement,char *responsable){ + if(ld==NULL) + return ld; + if(strcmp(ld->departement,departement) ==0 && strcmp(ld->resp,responsable) ==0) + return suppressionTete(ld); + ld->suivant=suppression(ld->suivant,departement,responsable); + return ld; + } + +ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n){ + int comp,trouv,i; + for(i=0;idepartement,departement); + if(comp==0) + trouv=i; + } + if(trouv ==0){ + printf("departement non existant"); + exit(1); + } + else{ + ld[i].nbP=MnbP; + } + return ld; +} + + + +ListeD Enfiler(ListeD ld, char departement[30], int nbP, char resp[30]) { + MaillonDept *mN; + mN = (MaillonDept*)malloc(sizeof(MaillonDept)); + if(mN==NULL){printf("pb ouv malloc");exit(1);} + strcpy(mN->departement, departement); + mN->nbP = nbP; + strcpy(mN->resp, resp); + mN->suivant = NULL; + printf("\naa"); + if (ld == NULL) { + ld = mN; + } else { + MaillonDept *mD; + mD = ld; + while (mD->suivant != NULL) { + mD = mD->suivant; + } + mD->suivant = mN; + } + return ld; +} +<<<<<<< HEAD + +======= +>>>>>>> 3af764446c4614b06d8ad0449b4f994987a5e5af +/* +VilleIUT defiler(VilleIUT V){ + MaillonDept *temp; + if(testVide(V)){ + printf("testVide"); + return V; + } + temp=V.Ville; + V.Ville=temp->suivant; + free(temp); + if(V.Ville==NULL) + V.Idept=NULL; + return V; +} +*/ From 5d6fc7822eb122127cbdb21d9e06ec4f11fd9e1f Mon Sep 17 00:00:00 2001 From: Benjamin BACHELARD Date: Thu, 5 Jan 2023 09:47:54 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Ajout=20de=20diff=C3=A9rentes=20fonctions,?= =?UTF-8?q?=20et=20modifications=20dans=20adminIut.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminIut.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/adminIut.c b/adminIut.c index 1269ab6..4122aa8 100644 --- a/adminIut.c +++ b/adminIut.c @@ -119,10 +119,6 @@ ListeD Enfiler(ListeD ld, char departement[30], int nbP, char resp[30]) { } return ld; } -<<<<<<< HEAD - -======= ->>>>>>> 3af764446c4614b06d8ad0449b4f994987a5e5af /* VilleIUT defiler(VilleIUT V){ MaillonDept *temp; From 76ad6a62a4d72d2633a08aa61b0a97b8775d885e Mon Sep 17 00:00:00 2001 From: Benjamin BACHELARD Date: Thu, 5 Jan 2023 09:56:24 +0100 Subject: [PATCH 6/6] fini modifnbP et Enfiler --- adminIut.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adminIut.c b/adminIut.c index 4122aa8..547e5c0 100644 --- a/adminIut.c +++ b/adminIut.c @@ -81,17 +81,17 @@ ListeD suppression(ListeD ld,char *departement,char *responsable){ ListeD ModifinbP(ListeD ld, char departement[30], int MnbP, int n){ int comp,trouv,i; - for(i=0;idepartement,departement); if(comp==0) trouv=i; } - if(trouv ==0){ + if(trouv==0){ printf("departement non existant"); exit(1); } else{ - ld[i].nbP=MnbP; + ld->nbP=MnbP; } return ld; }