Modifications de la fonction pour modifier le nombre de places, mais bug lors du changement de la valeur

master
Nicolas BLONDEAU 2 years ago
parent f8cb442e6b
commit f76ad2a7f9

@ -5,7 +5,7 @@
void MenuAdministrateur(VilleIUT *tiut[],int n){
char departement[30], respon[30], Vmodif[31],tVille[31], tdepartemnt[30], AouD;
int choix = 1, nbp, i, j, codeRet, Mnbp,good=0,reussi=0;
int choix = 1, nbp, i, j, Mnbp,good=0,reussi=0;
VilleIUT V;
while(choix>0 && choix<6){
printf("\n >--------------------------------------------------------<\n");
@ -22,40 +22,34 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
system("cls");
system("clear");
if(choix==1){
char rech[31];
char rech[31], rech2[31];
int trouve = 0;
printf("\nEntrez le nom d'une ville ou d'un IUT : ");
ListeD ld;
printf("\nEntrez le nom d'une ville : ");
scanf("%s%*c", &rech);
for(i=0;i<n && trouve!=1;i++){
ld = tiut[i]->ldept;
if(strcmp(tiut[i]->ville, rech)==0){
printf("\nIUT trouvé à %s !\n", rech);
trouve = 1;
codeRet = 0;
printf("\nNom du département à modifier : ");
scanf("%s", rech2);
while(ld!=NULL){
if(strcmp(ld->departement, rech2)==0 && ld->AouD == 'D'){
printf("\nProblème, phase de candidature à l'arrêt pour ce département.\n");
good=1;
}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);
reussi=1;
}
trouve = 1;
ld = ld->suivant;
}
}
else if(i==n-1){
printf("\nIl n'y pas d'IUT dans votre ville.\n");
codeRet = 1;
}
}
//BUG CODE ICI -> RECHERCHE NON FONCTIONNELLE AVEC DEPARTEMENT, VOIR LIEN AVEC VILLE POUR TROUVER...
if(codeRet==0){
printf("\nDépartement à modifier : ");
scanf("%s",departement);
for(j=0;j<tiut[i]->nbDep;j++){
if(strcmp(tiut[i]->ldept->departement, departement) == 0 && tiut[i]->ldept->AouD == 'D'){
printf("%c",tiut[i]->ldept->AouD );
printf("Problème, phase de candidature à l'arrêt pour ce département.\n");
good=1;
}
}
if(good==0){
printf("\nNombre de place après modification : ");
scanf("%d",&Mnbp);
tiut[i]->ldept=ModifinbP(tiut[i]->ldept,departement,Mnbp,n);
reussi=1;
}
if(reussi==0)
printf("\nProblème, erreur de syntaxe\n");
}
}
if(choix==2){
@ -154,11 +148,10 @@ void MenuAdministrateur(VilleIUT *tiut[],int n){
return ld;
}
ListeD ModifinbP(ListeD ld, char *departement, int MnbP, int n){
ListeD ModifinbP(ListeD ld, char departement[31], int MnbP, int n){
int comp,trouv,i;
for(i=0;i<=n;i++){
comp=strcmp(ld->departement,departement);
if(comp==0)
if(strcmp(ld->departement, departement))
trouv=i;
}
if(trouv==0){

Loading…
Cancel
Save