correction erreur de syntaxe SAE.c et fonction de bas réalisé SAEl.c

master
Alexis LAURENT 2 years ago
parent aa19f5eac5
commit 33a34bcc53

50
SAE.c

@ -36,7 +36,7 @@ bool verifQuit(void)
return true; return true;
if (strcmp(choix,"non")==0) if (strcmp(choix,"non")==0)
return false; return false;
printf("Erreur de sélection ! Veillez réessayer \n") printf("Erreur de sélection ! Veuillez réessayer \n");
} }
} }
@ -51,7 +51,7 @@ bool verifSelection(void)
return true; return true;
if (strcmp(choix,"non")==0) if (strcmp(choix,"non")==0)
return false; return false;
printf("Erreur de sélection ! Veillez réessayer \n") printf("Erreur de sélection ! Veuillez réessayer \n");
} }
} }
@ -65,7 +65,7 @@ bool confirmationSup(void)
return true; return true;
if (strcmp(choix,"non")==0) if (strcmp(choix,"non")==0)
return false; return false;
printf("Erreur de sélection ! Veillez réessayer \n") printf("Erreur de sélection ! Veuillez réessayer \n");
} }
@ -160,11 +160,9 @@ int gestionMenuAdmin(void)
system("clear"); system("clear");
switch(choix){ switch(choix){
case 1: case 1:
AffichageVille(tiut, nbEle);
clearpage(); clearpage();
break; break;
case 2: case 2:
AffichageGlobalDepVille(tiut, nbEle);
clearpage(); clearpage();
break; break;
case 3: case 3:
@ -204,9 +202,9 @@ void AffichageVille(VilleIUT **tiut, int nbEle)
{ {
int i; int i;
printf("\tIUT par ville :"); printf("\tIUT par ville :");
for(i=0,i<nbEle;i = i + 1) for(i=0;i<nbEle;i++)
{ {
printf("- %s\n",tab[i]->ville); printf("- %s\n",tiut[i]->ville);
} }
} }
@ -214,13 +212,13 @@ void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle)
{ {
int i; int i;
printf("\tDépartement par IUT :\n"); printf("\tDépartement par IUT :\n");
for(i=0,i<nbEle;i = i + 1) for(i=0;i<nbEle;i++)
{ {
printf("- %s :\n\t",tiut[i]->ville); printf("- %s :\n\t",tiut[i]->ville);
while(tiut->idDept != NULL) while(tiut[i]->idDept != NULL)
{ {
printf("|%s|\n",tiut->idDept->departement); printf("|%s|\n",tiut[i]->idDept->departement);
tiut->idDept = tiut->idDept->suiv; tiut[i]->idDept = tiut[i]->idDept->suiv;
} }
} }
} }
@ -252,8 +250,8 @@ int rechVille(VilleIUT **tiut, int nbEle, char code[], int *trouve)
void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle) void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
{ {
ListeDept *aux; MaillonDept *aux;
aux =(ListeDept *)malloc(sizeof(ListeDept)); aux =(MaillonDept *)malloc(sizeof(MaillonDept));
char code[30]; char code[30];
int pos,trouve = 0; int pos,trouve = 0;
while(1) while(1)
@ -293,7 +291,7 @@ void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
free(aux); free(aux);
} }
void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle) void AffichageDepVille(VilleIUT **tiut, int nbEle)
{ {
char code[30]; char code[30];
int pos,trouve = 0; int pos,trouve = 0;
@ -302,7 +300,6 @@ void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle)
printf("IUT : "); printf("IUT : ");
scanf("%s",code); scanf("%s",code);
pos = rechVille(tiut, nbEle, code,&trouve); pos = rechVille(tiut, nbEle, code,&trouve);
aux = tiut[pos]->idDept;
if (trouve == 1) if (trouve == 1)
{ {
printf("%s :\n\t",tiut[pos]->ville); printf("%s :\n\t",tiut[pos]->ville);
@ -313,13 +310,12 @@ void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle)
if(!verifSelection()) if(!verifSelection())
break; break;
} }
free(aux)
} }
void AffichageDeptVille(VilleIUT **tiut, int nbEle) void AffichageDeptVille(VilleIUT **tiut, int nbEle)
{ {
ListeDept *aux; MaillonDept *aux;
aux =(ListeDept *)malloc(sizeof(ListeDept)); aux =(MaillonDept *)malloc(sizeof(MaillonDept));
char code[30]; char code[30];
int pos = 0, nbocc = 0; int pos = 0, nbocc = 0;
while(1) while(1)
@ -334,7 +330,7 @@ void AffichageDeptVille(VilleIUT **tiut, int nbEle)
{ {
if(strcmp(aux->departement, code)==0) if(strcmp(aux->departement, code)==0)
{ {
affichageListeDept(aux) affichageListeDept(aux);
nbocc = nbocc + 1; nbocc = nbocc + 1;
break; break;
} }
@ -353,7 +349,7 @@ void AffichageGlobalIUT(VilleIUT **tiut, int nbEle)
int pos = 0; int pos = 0;
while(pos < nbEle) while(pos < nbEle)
{ {
printf("Ville : %s\n",tiut[pos]->Ville); printf("Ville : %s\n",tiut[pos]->ville);
affichageListeDept(tiut[pos]->idDept); affichageListeDept(tiut[pos]->idDept);
pos = pos + 1; pos = pos + 1;
printf("\n"); printf("\n");
@ -362,8 +358,8 @@ void AffichageGlobalIUT(VilleIUT **tiut, int nbEle)
void MiseAJourNbPlace(VilleIUT **tiut, int nbEle) void MiseAJourNbPlace(VilleIUT **tiut, int nbEle)
{ {
ListeDept *aux; MaillonDept *aux;
aux =(ListeDept *)malloc(sizeof(ListeDept)); aux =(MaillonDept *)malloc(sizeof(MaillonDept));
int nouvNbPlace, pos, trouve; int nouvNbPlace, pos, trouve;
char code[30]; char code[30];
while(1) while(1)
@ -426,7 +422,7 @@ void creationDept(VilleIUT **tiut, int nbEle)
nom[strlen(nom)-1] = "\0"; nom[strlen(nom)-1] = "\0";
printf("Nombre de place du Département %s : ",code); printf("Nombre de place du Département %s : ",code);
scanf("%d", nbP); scanf("%d", nbP);
tiut[pos]->idDept = inserer(tiut[pos]->idDept,code,nom,nbP) tiut[pos]->idDept = inserer(tiut[pos]->idDept,code,nom,nbP);
printf("insertion du département %s effectuer \n", code); printf("insertion du département %s effectuer \n", code);
if (!verifSelection()) if (!verifSelection())
break; break;
@ -456,7 +452,7 @@ void suppressionDept(VilleIUT **tiut, int nbEle)
scanf("%s", code); scanf("%s", code);
if (recherche(tiut[pos]->idDept, code)) if (recherche(tiut[pos]->idDept, code))
if (confirmationSup()) if (confirmationSup())
tiut->idDept = supprimer(tiut->idDept, code); tiut[pos]->idDept = supprimer(tiut[pos]->idDept, code);
if (!recherche(tiut[pos]->idDept, code)) if (!recherche(tiut[pos]->idDept, code))
printf("Ce Département n'existe pas dans l'IUT de %s \n",tiut[pos]->ville); printf("Ce Département n'existe pas dans l'IUT de %s \n",tiut[pos]->ville);
if (!verifSelection()) if (!verifSelection())
@ -487,12 +483,12 @@ void modifChefDept(VilleIUT **tiut, int nbEle)
{ {
if(strcmp(tiut[pos]->idDept->departement, code) == 1) if(strcmp(tiut[pos]->idDept->departement, code) == 1)
{ {
printf("Nom de l'ancien chef de département %s de %s : %s\n",tiut[pos]->idDept->departement, tiut[pos]->ville,tiut[pos]->idDept->resp); printf("Nom de l'ancien chef de département %s de %s : %s\n",tiut[pos]->idDept->departement, tiut[pos]->ville,tiut[pos]->idDept->responsable);
printf("nom du nouveau chef de département %s de %s :",tiut[pos]->idDept->departement, tiut[pos]->ville); printf("nom du nouveau chef de département %s de %s :",tiut[pos]->idDept->departement, tiut[pos]->ville);
fgets(code,30,stdin); fgets(code,30,stdin);
code[strlen(code)-1] = "\0"; code[strlen(code)-1] = "\0";
tiut[pos]->idDept->resp = code; strcpy(code, tiut[pos]->idDept->responsable);
printf("Chef de département : %s\n",tiut[pos]->idDept->resp); printf("Chef de département : %s\n",tiut[pos]->idDept->responsable);
} }
} }
} }

Loading…
Cancel
Save