|
|
|
@ -108,7 +108,7 @@ int menuAdminAffiche(void)
|
|
|
|
|
return choix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void gestionMenu(void)
|
|
|
|
|
void gestionMenu(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int choix;
|
|
|
|
|
while(1)
|
|
|
|
@ -149,7 +149,7 @@ void gestionMenu(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int gestionMenuAdmin(void)
|
|
|
|
|
int gestionMenuAdmin(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int choix;
|
|
|
|
|
if (!motdepasseVerif())
|
|
|
|
@ -195,7 +195,11 @@ int gestionMenuAdmin(void)
|
|
|
|
|
|
|
|
|
|
void global(void)
|
|
|
|
|
{
|
|
|
|
|
gestionMenu();
|
|
|
|
|
VilleIUT *tiut[30];
|
|
|
|
|
int nbEle;
|
|
|
|
|
//nbEle = chargement(tiut,30);
|
|
|
|
|
triEchange(tiut, nbEle);
|
|
|
|
|
gestionMenu(tiut, nbEle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
|
@ -204,7 +208,7 @@ void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
printf("\tIUT par ville :");
|
|
|
|
|
for(i=0;i<nbEle;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("- %s\n",tiut[i]->ville);
|
|
|
|
|
printf("- %s",tiut[i]->ville);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -214,7 +218,8 @@ void AffichageGlobalDepVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
printf("\tDépartement par IUT :\n");
|
|
|
|
|
for(i=0;i<nbEle;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("- %s :\n\t",tiut[i]->ville);
|
|
|
|
|
ville(tiut[i]->ville);
|
|
|
|
|
printf(" :\n\t");
|
|
|
|
|
while(tiut[i]->idDept != NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("|%s|\n",tiut[i]->idDept->departement);
|
|
|
|
@ -227,31 +232,38 @@ void AffichageNbplaceDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int pos;
|
|
|
|
|
for (pos = 0; pos < nbEle; pos++)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
AffichageVille(tiut[pos]->ville);
|
|
|
|
|
printf(" -> \t");
|
|
|
|
|
while(tiut[pos]->idDept->suiv != NULL && pos < nbEle)
|
|
|
|
|
{
|
|
|
|
|
printf("%s -> |%s, %d places|\n",tiut[pos]->ville,tiut[pos]->idDept->departement, tiut[pos]->idDept->nbPers);
|
|
|
|
|
printf("|%s, %d places|\n\t",tiut[pos]->idDept->departement, tiut[pos]->idDept->nbPers);
|
|
|
|
|
tiut[pos]->idDept = tiut[pos]->idDept->suiv;
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int rechVille(VilleIUT **tiut, int nbEle, char code[], int *trouve)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
while(i<nbEle)
|
|
|
|
|
int inf = 0, sup = nbEle - 1, m;
|
|
|
|
|
while(inf <= sup)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(code,tiut[i]->ville)==0)
|
|
|
|
|
m = (inf + sup)/2;
|
|
|
|
|
if (strcmp(tiut[r]->ville, code)==0)
|
|
|
|
|
{
|
|
|
|
|
*trouve = 1;
|
|
|
|
|
i = i + 1;
|
|
|
|
|
return m;
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(tiut[r]->ville, code)>0)
|
|
|
|
|
sup = m - 1;
|
|
|
|
|
else inf = m + 1;
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
MaillonDept *aux;
|
|
|
|
|
aux =(MaillonDept *)malloc(sizeof(MaillonDept));
|
|
|
|
|
char code[30];
|
|
|
|
|
int pos,trouve = 0;
|
|
|
|
|
while(1)
|
|
|
|
@ -259,7 +271,6 @@ void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
printf("IUT : ");
|
|
|
|
|
scanf("%s",code);
|
|
|
|
|
pos = rechVille(tiut, nbEle, code,&trouve);
|
|
|
|
|
aux = tiut[pos]->idDept;
|
|
|
|
|
if (trouve == 1)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
@ -268,27 +279,18 @@ void AffichageNbplaceDeptVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
printf("Département : ");
|
|
|
|
|
scanf("%s",code);
|
|
|
|
|
trouve = 0;
|
|
|
|
|
while(aux->suiv != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(tiut[pos]->idDept->departement, code)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("%s -> |%s, %d places|\n",tiut[pos]->ville,aux->departement, aux->nbPers);
|
|
|
|
|
trouve = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
aux = aux->suiv;
|
|
|
|
|
}
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code);
|
|
|
|
|
if (aux == NULL)
|
|
|
|
|
printf("Département non présent à l'iut de %s",tiut[pos]->ville);
|
|
|
|
|
if (aux != NULL)
|
|
|
|
|
printf("%s -> |%s, %d places|\n",tiut[pos]->ville,aux->departement, aux->nbPers);
|
|
|
|
|
printf("Saisi Département :\n");
|
|
|
|
|
if(!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
aux = tiut[pos]->idDept;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else printf("Cette Ville n'as pas d'IUT\n");
|
|
|
|
|
else printf("%s n'a pas d'IUT\n",code);;
|
|
|
|
|
}
|
|
|
|
|
free(aux);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AffichageDepVille(VilleIUT **tiut, int nbEle)
|
|
|
|
@ -306,7 +308,8 @@ void AffichageDepVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
affichageListeDept(tiut[pos]->idDept);
|
|
|
|
|
}
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
printf("Département non présent à l'iut de %s",tiut[pos]->ville);
|
|
|
|
|
printf("%s n'a pas d'IUT\n",code);
|
|
|
|
|
printf("Saisi Ville :\n");
|
|
|
|
|
if(!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -315,7 +318,6 @@ void AffichageDepVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
void AffichageDeptVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
MaillonDept *aux;
|
|
|
|
|
aux =(MaillonDept *)malloc(sizeof(MaillonDept));
|
|
|
|
|
char code[30];
|
|
|
|
|
int pos = 0, nbocc = 0;
|
|
|
|
|
while(1)
|
|
|
|
@ -325,20 +327,16 @@ void AffichageDeptVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
printf("\nIUT ayant un département %s : \n",code);
|
|
|
|
|
for(pos = 0; pos < nbEle; pos++)
|
|
|
|
|
{
|
|
|
|
|
aux = tiut[pos]->idDept;
|
|
|
|
|
while(aux != NULL)
|
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code);
|
|
|
|
|
if(aux != NULL)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(aux->departement, code)==0)
|
|
|
|
|
{
|
|
|
|
|
affichageListeDept(aux);
|
|
|
|
|
nbocc = nbocc + 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
aux = aux->suiv;
|
|
|
|
|
AffichageVille(tiut[pos]->ville);
|
|
|
|
|
nbocc = nbocc + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (nbocc == 0)
|
|
|
|
|
printf("aucun département %s est présent en France\n", code);
|
|
|
|
|
printf("Saisi Département :\n");
|
|
|
|
|
if(!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -347,9 +345,12 @@ void AffichageDeptVille(VilleIUT **tiut, int nbEle)
|
|
|
|
|
void AffichageGlobalIUT(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int pos = 0;
|
|
|
|
|
printf("Ville : \t");
|
|
|
|
|
while(pos < nbEle)
|
|
|
|
|
{
|
|
|
|
|
printf("Ville : %s\n",tiut[pos]->ville);
|
|
|
|
|
AffichageVille(VilleIUT)
|
|
|
|
|
printf(" :\n\t");
|
|
|
|
|
printf("Département:\tNombre de places:\tNom du Responsable:\n\t");
|
|
|
|
|
affichageListeDept(tiut[pos]->idDept);
|
|
|
|
|
pos = pos + 1;
|
|
|
|
|
printf("\n");
|
|
|
|
@ -359,7 +360,6 @@ void AffichageGlobalIUT(VilleIUT **tiut, int nbEle)
|
|
|
|
|
void MiseAJourNbPlace(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
MaillonDept *aux;
|
|
|
|
|
aux =(MaillonDept *)malloc(sizeof(MaillonDept));
|
|
|
|
|
int nouvNbPlace, pos, trouve;
|
|
|
|
|
char code[30];
|
|
|
|
|
while(1)
|
|
|
|
@ -369,38 +369,39 @@ void MiseAJourNbPlace(VilleIUT **tiut, int nbEle)
|
|
|
|
|
pos = rechVille(tiut, nbEle, code,&trouve);
|
|
|
|
|
if (trouve == 1)
|
|
|
|
|
{
|
|
|
|
|
aux = tiut[pos]->idDept;
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("Département : ");
|
|
|
|
|
scanf("%s",code);
|
|
|
|
|
while(tiut[pos]->idDept->suiv != NULL)
|
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code);
|
|
|
|
|
if (aux != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp(tiut[pos]->idDept->departement, code)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("Ancien nombre de places : %d",tiut[pos]->idDept->nbPers);
|
|
|
|
|
printf("Nouveau nombre de places : ", nouvNbPlace);
|
|
|
|
|
scanf("%d", &nouvNbPlace);
|
|
|
|
|
tiut[pos]->idDept->nbPers = nouvNbPlace;
|
|
|
|
|
printf("Mise à jour effectuer avec succès !");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
tiut[pos]->idDept = tiut[pos]->idDept->suiv;
|
|
|
|
|
printf("Ancien nombre de places : %d",aux->nbPers);
|
|
|
|
|
printf("Nouveau nombre de places : ", nouvNbPlace);
|
|
|
|
|
scanf("%d", &nouvNbPlace);
|
|
|
|
|
aux->nbPers = nouvNbPlace;
|
|
|
|
|
printf("Mise à jour effectuer avec succès !");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
if (aux == NULL)
|
|
|
|
|
printf("Département non présent à l'iut de %s",tiut[pos]->ville);
|
|
|
|
|
printf("Saisi Département :\n");
|
|
|
|
|
if(!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
tiut[pos]->idDept = aux;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
printf("Cet ville n'a pas d'IUT\n");
|
|
|
|
|
printf("Saisi Ville :\n");
|
|
|
|
|
if(!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
free(aux);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void creationDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
MaillonDept *aux;
|
|
|
|
|
char code[30], nom[30];
|
|
|
|
|
int trouve, pos, nbP;
|
|
|
|
|
while(1)
|
|
|
|
@ -414,9 +415,11 @@ void creationDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
|
scanf("%s", code);
|
|
|
|
|
if (recherche(tiut[pos]->idDept, code))
|
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code)
|
|
|
|
|
if (aux != NULL)
|
|
|
|
|
printf("Département déjà existant");
|
|
|
|
|
if (!recherche(tiut[pos]->idDept, code))
|
|
|
|
|
if (aux == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Nom du Responsable du Département de %s : ",code);
|
|
|
|
|
fgets(nom,30,stdin);
|
|
|
|
|
nom[strlen(nom)-1] = "\0";
|
|
|
|
@ -424,12 +427,15 @@ void creationDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
scanf("%d", nbP);
|
|
|
|
|
tiut[pos]->idDept = inserer(tiut[pos]->idDept,code,nom,nbP);
|
|
|
|
|
printf("insertion du département %s effectuer \n", code);
|
|
|
|
|
}
|
|
|
|
|
printf("Saisi Département :\n");
|
|
|
|
|
if (!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
printf("Cet ville n'a pas d'IUT\n");
|
|
|
|
|
printf("Saisi Ville :\n");
|
|
|
|
|
if(!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -439,6 +445,7 @@ void creationDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
|
|
|
|
|
void suppressionDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
MaillonDept *aux;
|
|
|
|
|
char code[30];
|
|
|
|
|
int trouve, pos, nbP;
|
|
|
|
|
while(1)
|
|
|
|
@ -450,21 +457,28 @@ void suppressionDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
|
scanf("%s", code);
|
|
|
|
|
if (recherche(tiut[pos]->idDept, code))
|
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code)
|
|
|
|
|
if (aux != NULL)
|
|
|
|
|
if (confirmationSup())
|
|
|
|
|
tiut[pos]->idDept = supprimer(tiut[pos]->idDept, code);
|
|
|
|
|
if (!recherche(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");
|
|
|
|
|
if (!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
printf("Cet ville n'a pas d'IUT\n");
|
|
|
|
|
printf("Saisi Ville :\n");
|
|
|
|
|
if (!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void modifChefDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
MaillonDept *aux;
|
|
|
|
|
char code[30];
|
|
|
|
|
int trouve, pos, nbP;
|
|
|
|
|
while(1)
|
|
|
|
@ -474,34 +488,62 @@ void modifChefDept(VilleIUT **tiut, int nbEle)
|
|
|
|
|
pos = rechVille(tiut, nbEle, code, &trouve);
|
|
|
|
|
if (trouve == 1)
|
|
|
|
|
{
|
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
|
scanf("%s", code);
|
|
|
|
|
if (recherche(tiut[pos]->idDept, code))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
while(tiut[pos]->idDept->suiv != NULL)
|
|
|
|
|
{
|
|
|
|
|
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->responsable);
|
|
|
|
|
printf("nom du nouveau chef de département %s de %s :",tiut[pos]->idDept->departement, tiut[pos]->ville);
|
|
|
|
|
fgets(code,30,stdin);
|
|
|
|
|
code[strlen(code)-1] = "\0";
|
|
|
|
|
strcpy(code, tiut[pos]->idDept->responsable);
|
|
|
|
|
printf("Chef de département : %s\n",tiut[pos]->idDept->responsable);
|
|
|
|
|
}
|
|
|
|
|
while(1)
|
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
|
scanf("%s", code);
|
|
|
|
|
aux = rechercheDept(tiut[pos]->idDept, code);
|
|
|
|
|
if (aux != NULL)
|
|
|
|
|
{
|
|
|
|
|
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";
|
|
|
|
|
strcpy(code, aux->responsable);
|
|
|
|
|
printf("Chef de département : %s\n",tiut[pos]->idDept->responsable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!recherche(tiut[pos]->idDept, code))
|
|
|
|
|
printf("Ce Département n'existe pas dans l'IUT de %s \n",tiut[pos]->ville);
|
|
|
|
|
if (!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (aux == NULL)
|
|
|
|
|
printf("Ce Département n'existe pas dans l'IUT de %s \n",tiut[pos]->ville);
|
|
|
|
|
printf("Saisi Département :\n");
|
|
|
|
|
if (!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (trouve == 0)
|
|
|
|
|
printf("Cet ville n'a pas d'IUT\n");
|
|
|
|
|
printf("Saisi Ville :\n");
|
|
|
|
|
if (!verifSelection())
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void triEchange(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int pge;
|
|
|
|
|
while(nbEle>1)
|
|
|
|
|
{
|
|
|
|
|
pge = plusGrand(tiut, nbEle);
|
|
|
|
|
echanger(tiut,pge,nb-1);
|
|
|
|
|
nb = nb - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int plusGrand(VilleIUT **tiut, int nbEle)
|
|
|
|
|
{
|
|
|
|
|
int pge = 0, i;
|
|
|
|
|
for (i = 1, i < nb, i++)
|
|
|
|
|
if (strcmp(tiut[i]->ville,tiut[pge]->ville)>0)
|
|
|
|
|
pge = 1;
|
|
|
|
|
return pge;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void echanger(VilleIUT **tiut, int i, int j)
|
|
|
|
|
{
|
|
|
|
|
VilleIUT *aux;
|
|
|
|
|
aux = tiut[i];
|
|
|
|
|
tiut[i] = tiut[j];
|
|
|
|
|
tiut[j] = aux;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clearpage(void)
|
|
|
|
|
{
|
|
|
|
|
char entre;
|
|
|
|
@ -509,3 +551,6 @@ void clearpage(void)
|
|
|
|
|
scanf("%*c%c", &entre);
|
|
|
|
|
system("clear");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|