06/01 SAE.c

master
Alexis LAURENT 2 years ago
parent 0fbcd3654d
commit 9836e42a34

61
SAE.c

@ -137,7 +137,7 @@ void gestionMenu(VilleIUT **tiut, int nbEle)
clearpage();
break;
case 9:
choix = gestionMenuAdmin();
choix = gestionMenuAdmin(tiut, nbEle);
if (choix == -1)
return;
break;
@ -195,20 +195,24 @@ int gestionMenuAdmin(VilleIUT **tiut, int nbEle)
void global(void)
{
VilleIUT *tiut[30];
int nbEle;
//nbEle = chargement(tiut,30);
triEchange(tiut, nbEle);
gestionMenu(tiut, nbEle);
int tailleL, i;
VilleIUT** tab;
char nomFich[20];
strcpy(nomFich,"iut.txt");
printf("charg\n");
tab = chargementVille(nomFich,30,&tailleL);
printf("\n");
triEchange(tab, tailleL);
AffichageGlobalIUT(tab, tailleL);
}
void AffichageVille(VilleIUT **tiut, int nbEle)
{
int i;
printf("\tIUT par ville :");
printf("\tIUT par ville :\n");
for(i=0;i<nbEle;i++)
{
printf("- %s",tiut[i]->ville);
printf("- %s\n\t",tiut[i]->ville);
}
}
@ -218,8 +222,7 @@ void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle)
printf("\tDépartement par IUT :\n");
for(i=0;i<nbEle;i++)
{
ville(tiut[i]->ville);
printf(" :\n\t");
printf("%s :\n", tiut[i]->ville);
while(tiut[i]->idDept != NULL)
{
printf("|%s|\n",tiut[i]->idDept->departement);
@ -233,8 +236,7 @@ void AffichageNbplaceDept(VilleIUT **tiut, int nbEle)
int pos;
for (pos = 0; pos < nbEle; pos++)
{
AffichageVille(tiut[pos]->ville);
printf(" -> \t");
printf("%s -> \t", tiut[pos]->ville);
while(tiut[pos]->idDept->suiv != NULL && pos < nbEle)
{
printf("|%s, %d places|\n\t",tiut[pos]->idDept->departement, tiut[pos]->idDept->nbPers);
@ -250,12 +252,12 @@ int rechVille(VilleIUT **tiut, int nbEle, char code[], int *trouve)
while(inf <= sup)
{
m = (inf + sup)/2;
if (strcmp(tiut[r]->ville, code)==0)
if (strcmp(tiut[m]->ville, code)==0)
{
*trouve = 1;
return m;
}
if (strcmp(tiut[r]->ville, code)>0)
if (strcmp(tiut[m]->ville, code)>0)
sup = m - 1;
else inf = m + 1;
}
@ -289,7 +291,10 @@ void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
break;
}
}
else printf("%s n'a pas d'IUT\n",code);;
if (trouve == 0) printf("%s n'a pas d'IUT\n",code);
printf("Saisi Département :\n");
if(!verifSelection())
break;
}
}
@ -330,7 +335,7 @@ void AffichageDeptVille(VilleIUT **tiut, int nbEle)
aux = rechercheDept(tiut[pos]->idDept, code);
if(aux != NULL)
{
AffichageVille(tiut[pos]->ville);
printf("- %s\n", tiut[pos]->ville);
nbocc = nbocc + 1;
}
}
@ -348,8 +353,7 @@ void AffichageGlobalIUT(VilleIUT **tiut, int nbEle)
printf("Ville : \t");
while(pos < nbEle)
{
AffichageVille(VilleIUT)
printf(" :\n\t");
printf("-%s :\n\t", tiut[pos]->ville);
printf("Département:\tNombre de places:\tNom du Responsable:\n\t");
affichageListeDept(tiut[pos]->idDept);
pos = pos + 1;
@ -415,17 +419,17 @@ void creationDept(VilleIUT **tiut, int nbEle)
{
printf("Nom du Département : ");
scanf("%s", code);
aux = rechercheDept(tiut[pos]->idDept, code)
aux = rechercheDept(tiut[pos]->idDept, code);
if (aux != NULL)
printf("Département déjà existant");
if (aux == NULL)
{
printf("Nom du Responsable du Département de %s : ",code);
fgets(nom,30,stdin);
nom[strlen(nom)-1] = "\0";
nom[strlen(nom)-1] = '\0';
printf("Nombre de place du Département %s : ",code);
scanf("%d", nbP);
tiut[pos]->idDept = inserer(tiut[pos]->idDept,code,nom,nbP);
tiut[pos]->idDept = insererDept(tiut[pos]->idDept,code,nom,nbP);
printf("insertion du département %s effectuer \n", code);
}
printf("Saisi Département :\n");
@ -457,10 +461,10 @@ void suppressionDept(VilleIUT **tiut, int nbEle)
{
printf("Nom du Département : ");
scanf("%s", code);
aux = rechercheDept(tiut[pos]->idDept, code)
aux = rechercheDept(tiut[pos]->idDept, code);
if (aux != NULL)
if (confirmationSup())
tiut[pos]->idDept = supprimer(tiut[pos]->idDept, code);
tiut[pos]->idDept = supprimerDept(tiut[pos]->idDept, code);
if (aux == NULL)
printf("Ce Département n'existe pas dans l'IUT de %s \n",tiut[pos]->ville);
printf("Saisi Département :\n");
@ -497,7 +501,7 @@ void modifChefDept(VilleIUT **tiut, int nbEle)
printf("Nom de l'ancien chef de département %s de %s : %s\n",aux->departement, tiut[pos]->ville,aux->responsable);
printf("Nom du nouveau chef de département %s de %s :",aux->departement, tiut[pos]->ville);
fgets(code,30,stdin);
code[strlen(code)-1] = "\0";
code[strlen(code)-1] = '\0';
strcpy(code, aux->responsable);
printf("Chef de département : %s\n",tiut[pos]->idDept->responsable);
}
@ -522,15 +526,15 @@ void triEchange(VilleIUT **tiut, int nbEle)
while(nbEle>1)
{
pge = plusGrand(tiut, nbEle);
echanger(tiut,pge,nb-1);
nb = nb - 1;
echanger(tiut,pge,nbEle-1);
nbEle = nbEle - 1;
}
}
int plusGrand(VilleIUT **tiut, int nbEle)
{
int pge = 0, i;
for (i = 1, i < nb, i++)
for (i = 1; i < nbEle; i++)
if (strcmp(tiut[i]->ville,tiut[pge]->ville)>0)
pge = 1;
return pge;
@ -551,6 +555,3 @@ void clearpage(void)
scanf("%*c%c", &entre);
system("clear");
}

Loading…
Cancel
Save