Réglage de problèmes multiples.

master
Yann CHAMPEAU 3 years ago
parent 98053b24e4
commit 31c6d9465c

@ -42,7 +42,7 @@ int loadIUT(VilleIUT** tiut){
m=tiut[i]->ldept;
for(int j=0; j<nbIUTs; j++){
fread(m->departement,sizeof(char),31,f);
fread(m->nbp,sizeof(int),1,f);
fread(&m->nbp,sizeof(int),1,f);
fread(m->resp,sizeof(char),51,f);
if(j<nbIUTs-1){
m->suivant=(MaillonDep*)malloc(sizeof(MaillonDep));

@ -26,10 +26,10 @@ void MenuUser(VilleIUT* lvIUT[],int tlogi)
{
printf("Choisissez l'action que vous voulez exécuter : ");
if (!(scanf("%d",intUserEntry)))printf("Entrée innexacte. Veuillez réessayer");
if (intUserEntry==1) SearchCityWithIUT(VilleIUT* lvIUT[], int tlogi);
if (intUserEntry==2) DepEachIUT(VilleIUT* lvIUT[], int tlogi);
if (intUserEntry==3) SearchPlaceFromDepInIUT(VilleIUT* lvIUT[],int tlogi);
if (intUserEntry==4) SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi);
if (intUserEntry==1) SearchCityWithIUT(lvIUT,tlogi);
if (intUserEntry==2) DepEachIUT(lvIUT,tlogi);
if (intUserEntry==3) SearchPlaceFromDepInIUT(lvIUT,tlogi);
if (intUserEntry==4) SearchIUTFromDep(lvIUT,tlogi);
if (intUserEntry==9) printf("Sortie en cours.\n");
else printf("Entrée innexacte. Veuillez réessayer");
}
@ -142,11 +142,11 @@ void menuAdmin(VilleIUT* tiut[],int tlogi){
reset();
break;
case 5:
modifNomResponsable(tiut,tlogi)
modifNomResponsable(tiut,tlogi);
reset();
break;
case 9:
quit=1
quit=1;
reset();
}
}
@ -154,9 +154,9 @@ void menuAdmin(VilleIUT* tiut[],int tlogi){
void modifPlaces(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):");
char* ville[31];
char ville[31];
scanf("%*c%s",&ville);
if(ville=="Q") return;
if(ville[0]=='Q' && ville[1]=="\0") return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
@ -182,42 +182,42 @@ void modifPlaces(VilleIUT* tiut[],int tlogi){
void creerDep(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):");
char* ville[31];
char ville[31];
scanf("%*c%s",&ville);
if(ville=="Q") return;
if(ville[0]=='Q' && ville[1]=="\0") return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
return;
}
VilleIUT* v=tiut[noVille];
MaillonDep* m=v->ldept
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);
}
m=m->suiv;
m=m->suivant;
printf("\n\nEntrez le nom du département à créer :");
char dep[31];
scanf("%*c%s",&dep);
m->departement=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);
m->resp=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):");
char* ville[31];
char ville[31];
scanf("%*c%s",&ville);
if(ville=="Q") return;
if(ville[0]=='Q' && ville[1]=="\0") return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
@ -235,16 +235,17 @@ 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;
if(choix!="Y") return;
if(choix!='Y') return;
v->ldept=m->suivant;
free(m);
}
else{
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->suiv->departement,v->Ville);
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;
if(choix!="Y") return;
Maillon* temp=m->suivant;
if(choix!='Y') return;
MaillonDep* temp;
temp=m->suivant;
m->suivant=m->suivant->suivant;
free(temp);
}
@ -254,9 +255,9 @@ void supprimerDep(VilleIUT* tiut[],int tlogi){
void modifNomResponsable(VilleIUT* tiut[],int tlogi){
printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):");
char* ville[31];
char ville[31];
scanf("%*c%s",&ville);
if(ville=="Q") return;
if(ville[0]=='Q' && ville[1]=="\0") return;
int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville);
if(noVille<=0){
fprintf(stderr,"\nVille non existante !\n");
@ -270,12 +271,12 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){
fprintf(stderr,"\nDépartement non existant !\n");
return;
}
MaillonDep* m=v->ldept
MaillonDep* m=v->ldept;
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);
int nom;
scanf("%d",&nom);
m->resp=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;
}

@ -9,7 +9,7 @@
int main(void)
{
VilleIUT** tiut;
VilleIUT* tiut[36529];
int tlogi=loadIUT(tiut);
menu();
char user;

Loading…
Cancel
Save