diff --git a/adminIut.c b/adminIut.c index b744a6f..3ce935b 100644 --- a/adminIut.c +++ b/adminIut.c @@ -40,7 +40,7 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){ }else if(strcmp(ld->departement, rech2)==0 && ld->AouD == 'A'){ printf("\nNombre de place après modification : "); scanf("%d",&Mnbp); - tiut[i]->ldept=ModifinbP(ld, rech2, Mnbp,n); + tiut[i]->ldept=ModifinbP(tiut[i]->ldept, rech2, Mnbp,n); reussi=1; } trouve = 1; @@ -93,9 +93,9 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){ printf("\nVille où se situe le departement :"); scanf("%s",Vmodif); printf("\ndepartement :"); - scanf("%s",departement); + scanf("%s%*c",departement); printf("\nPour Activer taper A pour desactiver taper D :"); - scanf("%c%*c",&AouD); + scanf("%c%*c",&AouD);; for(i=0;iville, Vmodif)==0){ tiut[i]->ldept=ModifiAouD(tiut[i]->ldept,departement,AouD,n); @@ -149,49 +149,35 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){ } ListeD ModifinbP(ListeD ld, char departement[31], int MnbP, int n){ - int comp,trouv,i; + int i; for(i=0;i<=n;i++){ - if(strcmp(ld->departement, departement)) - trouv=i; - } - if(trouv==0){ - printf("departement non existant"); - exit(1); - } - else{ - ld->nbP=MnbP; + if(strcmp(ld->departement, departement)==0){ + ld->nbP=MnbP; + return ld; + } + ld=ld->suivant; } return ld; } ListeD ModifiRespon(ListeD ld, char departement[30], char respon[30], int n){ - int comp,trouv,i; + int i; for(i=0;i<=n;i++){ - comp=strcmp(ld->departement,departement); - if(comp==0) - trouv=i; - } - if(trouv==0){ - printf("departement non existant"); - exit(1); - } - else{ - strcpy(ld->resp, respon); + if(strcmp(ld->departement,departement)==0){ + strcpy(ld->resp, respon); + return ld; + } + ld=ld->suivant; } - return ld; + return ld; } ListeD ModifiAouD(ListeD ld, char departement[30], char AouD,int n){ - int comp,trouv,i; + int i; for(i=0;i<=n;i++){ - comp=strcmp(ld->departement,departement); - if(comp==0) - trouv=i; - } - if(trouv==0){ - printf("departement non existant"); - exit(1); - } - else{ - ld->AouD = AouD; + if(strcmp(ld->departement,departement)==0){ + ld->AouD=AouD; + return ld; + } + ld=ld->suivant; } return ld; }