|
|
@ -137,7 +137,7 @@ void gestionMenu(VilleIUT **tiut, int nbEle)
|
|
|
|
clearpage();
|
|
|
|
clearpage();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
case 9:
|
|
|
|
choix = gestionMenuAdmin();
|
|
|
|
choix = gestionMenuAdmin(tiut, nbEle);
|
|
|
|
if (choix == -1)
|
|
|
|
if (choix == -1)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -195,20 +195,24 @@ int gestionMenuAdmin(VilleIUT **tiut, int nbEle)
|
|
|
|
|
|
|
|
|
|
|
|
void global(void)
|
|
|
|
void global(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VilleIUT *tiut[30];
|
|
|
|
int tailleL, i;
|
|
|
|
int nbEle;
|
|
|
|
VilleIUT** tab;
|
|
|
|
//nbEle = chargement(tiut,30);
|
|
|
|
char nomFich[20];
|
|
|
|
triEchange(tiut, nbEle);
|
|
|
|
strcpy(nomFich,"iut.txt");
|
|
|
|
gestionMenu(tiut, nbEle);
|
|
|
|
printf("charg\n");
|
|
|
|
|
|
|
|
tab = chargementVille(nomFich,30,&tailleL);
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
triEchange(tab, tailleL);
|
|
|
|
|
|
|
|
AffichageGlobalIUT(tab, tailleL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
|
void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
printf("\tIUT par ville :");
|
|
|
|
printf("\tIUT par ville :\n");
|
|
|
|
for(i=0;i<nbEle;i++)
|
|
|
|
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");
|
|
|
|
printf("\tDépartement par IUT :\n");
|
|
|
|
for(i=0;i<nbEle;i++)
|
|
|
|
for(i=0;i<nbEle;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ville(tiut[i]->ville);
|
|
|
|
printf("%s :\n", tiut[i]->ville);
|
|
|
|
printf(" :\n\t");
|
|
|
|
|
|
|
|
while(tiut[i]->idDept != NULL)
|
|
|
|
while(tiut[i]->idDept != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("|%s|\n",tiut[i]->idDept->departement);
|
|
|
|
printf("|%s|\n",tiut[i]->idDept->departement);
|
|
|
@ -233,8 +236,7 @@ void AffichageNbplaceDept(VilleIUT **tiut, int nbEle)
|
|
|
|
int pos;
|
|
|
|
int pos;
|
|
|
|
for (pos = 0; pos < nbEle; pos++)
|
|
|
|
for (pos = 0; pos < nbEle; pos++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AffichageVille(tiut[pos]->ville);
|
|
|
|
printf("%s -> \t", tiut[pos]->ville);
|
|
|
|
printf(" -> \t");
|
|
|
|
|
|
|
|
while(tiut[pos]->idDept->suiv != NULL && pos < nbEle)
|
|
|
|
while(tiut[pos]->idDept->suiv != NULL && pos < nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("|%s, %d places|\n\t",tiut[pos]->idDept->departement, tiut[pos]->idDept->nbPers);
|
|
|
|
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)
|
|
|
|
while(inf <= sup)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m = (inf + sup)/2;
|
|
|
|
m = (inf + sup)/2;
|
|
|
|
if (strcmp(tiut[r]->ville, code)==0)
|
|
|
|
if (strcmp(tiut[m]->ville, code)==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
*trouve = 1;
|
|
|
|
*trouve = 1;
|
|
|
|
return m;
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strcmp(tiut[r]->ville, code)>0)
|
|
|
|
if (strcmp(tiut[m]->ville, code)>0)
|
|
|
|
sup = m - 1;
|
|
|
|
sup = m - 1;
|
|
|
|
else inf = m + 1;
|
|
|
|
else inf = m + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -289,7 +291,10 @@ void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
|
|
|
|
break;
|
|
|
|
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);
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code);
|
|
|
|
if(aux != NULL)
|
|
|
|
if(aux != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AffichageVille(tiut[pos]->ville);
|
|
|
|
printf("- %s\n", tiut[pos]->ville);
|
|
|
|
nbocc = nbocc + 1;
|
|
|
|
nbocc = nbocc + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -348,8 +353,7 @@ void AffichageGlobalIUT(VilleIUT **tiut, int nbEle)
|
|
|
|
printf("Ville : \t");
|
|
|
|
printf("Ville : \t");
|
|
|
|
while(pos < nbEle)
|
|
|
|
while(pos < nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AffichageVille(VilleIUT)
|
|
|
|
printf("-%s :\n\t", tiut[pos]->ville);
|
|
|
|
printf(" :\n\t");
|
|
|
|
|
|
|
|
printf("Département:\tNombre de places:\tNom du Responsable:\n\t");
|
|
|
|
printf("Département:\tNombre de places:\tNom du Responsable:\n\t");
|
|
|
|
affichageListeDept(tiut[pos]->idDept);
|
|
|
|
affichageListeDept(tiut[pos]->idDept);
|
|
|
|
pos = pos + 1;
|
|
|
|
pos = pos + 1;
|
|
|
@ -415,17 +419,17 @@ void creationDept(VilleIUT **tiut, int nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
scanf("%s", code);
|
|
|
|
scanf("%s", code);
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code)
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code);
|
|
|
|
if (aux != NULL)
|
|
|
|
if (aux != NULL)
|
|
|
|
printf("Département déjà existant");
|
|
|
|
printf("Département déjà existant");
|
|
|
|
if (aux == NULL)
|
|
|
|
if (aux == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Nom du Responsable du Département de %s : ",code);
|
|
|
|
printf("Nom du Responsable du Département de %s : ",code);
|
|
|
|
fgets(nom,30,stdin);
|
|
|
|
fgets(nom,30,stdin);
|
|
|
|
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 = insererDept(tiut[pos]->idDept,code,nom,nbP);
|
|
|
|
printf("insertion du département %s effectuer \n", code);
|
|
|
|
printf("insertion du département %s effectuer \n", code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("Saisi Département :\n");
|
|
|
|
printf("Saisi Département :\n");
|
|
|
@ -457,10 +461,10 @@ void suppressionDept(VilleIUT **tiut, int nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
scanf("%s", code);
|
|
|
|
scanf("%s", code);
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code)
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code);
|
|
|
|
if (aux != NULL)
|
|
|
|
if (aux != NULL)
|
|
|
|
if (confirmationSup())
|
|
|
|
if (confirmationSup())
|
|
|
|
tiut[pos]->idDept = supprimer(tiut[pos]->idDept, code);
|
|
|
|
tiut[pos]->idDept = supprimerDept(tiut[pos]->idDept, code);
|
|
|
|
if (aux == NULL)
|
|
|
|
if (aux == NULL)
|
|
|
|
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);
|
|
|
|
printf("Saisi Département :\n");
|
|
|
|
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 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);
|
|
|
|
printf("Nom du nouveau chef de département %s de %s :",aux->departement, tiut[pos]->ville);
|
|
|
|
fgets(code,30,stdin);
|
|
|
|
fgets(code,30,stdin);
|
|
|
|
code[strlen(code)-1] = "\0";
|
|
|
|
code[strlen(code)-1] = '\0';
|
|
|
|
strcpy(code, aux->responsable);
|
|
|
|
strcpy(code, aux->responsable);
|
|
|
|
printf("Chef de département : %s\n",tiut[pos]->idDept->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)
|
|
|
|
while(nbEle>1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pge = plusGrand(tiut, nbEle);
|
|
|
|
pge = plusGrand(tiut, nbEle);
|
|
|
|
echanger(tiut,pge,nb-1);
|
|
|
|
echanger(tiut,pge,nbEle-1);
|
|
|
|
nb = nb - 1;
|
|
|
|
nbEle = nbEle - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int plusGrand(VilleIUT **tiut, int nbEle)
|
|
|
|
int plusGrand(VilleIUT **tiut, int nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int pge = 0, i;
|
|
|
|
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)
|
|
|
|
if (strcmp(tiut[i]->ville,tiut[pge]->ville)>0)
|
|
|
|
pge = 1;
|
|
|
|
pge = 1;
|
|
|
|
return pge;
|
|
|
|
return pge;
|
|
|
@ -550,7 +554,4 @@ void clearpage(void)
|
|
|
|
printf("\nappuyé sur la touche [ENTREE] pour continuer");
|
|
|
|
printf("\nappuyé sur la touche [ENTREE] pour continuer");
|
|
|
|
scanf("%*c%c", &entre);
|
|
|
|
scanf("%*c%c", &entre);
|
|
|
|
system("clear");
|
|
|
|
system("clear");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|