|
|
@ -203,7 +203,9 @@ void global(void)
|
|
|
|
tab = chargementVille(nomFich,30,&tailleL);
|
|
|
|
tab = chargementVille(nomFich,30,&tailleL);
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
|
triEchange(tab, tailleL);
|
|
|
|
triEchange(tab, tailleL);
|
|
|
|
AffichageGlobalIUT(tab, tailleL);
|
|
|
|
creationDept(tab, tailleL);
|
|
|
|
|
|
|
|
AffichageGlobalDepVille(tab, tailleL);
|
|
|
|
|
|
|
|
SauvegarderIUT(tab, tailleL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
|
void AffichageVille(VilleIUT **tiut, int nbEle)
|
|
|
@ -353,8 +355,8 @@ void AffichageGlobalIUT(VilleIUT **tiut, int nbEle)
|
|
|
|
printf("Ville : \t");
|
|
|
|
printf("Ville : \t");
|
|
|
|
while(pos < nbEle)
|
|
|
|
while(pos < nbEle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("-%s :\n\t", tiut[pos]->ville);
|
|
|
|
printf("-%s \n", tiut[pos]->ville);
|
|
|
|
printf("Département:\tNombre de places:\tNom du Responsable:\n\t");
|
|
|
|
printf("Département:\tNombre de places:\tNom du Responsable:\n");
|
|
|
|
affichageListeDept(tiut[pos]->idDept);
|
|
|
|
affichageListeDept(tiut[pos]->idDept);
|
|
|
|
pos = pos + 1;
|
|
|
|
pos = pos + 1;
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
@ -418,7 +420,7 @@ void creationDept(VilleIUT **tiut, int nbEle)
|
|
|
|
while(1)
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
printf("Nom du Département : ");
|
|
|
|
scanf("%s", code);
|
|
|
|
scanf("%s%*c", 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");
|
|
|
@ -428,7 +430,7 @@ void creationDept(VilleIUT **tiut, int nbEle)
|
|
|
|
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 = insererDept(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);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -548,6 +550,42 @@ void echanger(VilleIUT **tiut, int i, int j)
|
|
|
|
tiut[j] = aux;
|
|
|
|
tiut[j] = aux;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int longueurListe(ListeDept l)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int cpt = 0;
|
|
|
|
|
|
|
|
while (l != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cpt += 1;
|
|
|
|
|
|
|
|
l = l->suiv;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return cpt;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SauvegarderIUT(VilleIUT** tabV, int tailleL) {
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
FILE* flot;
|
|
|
|
|
|
|
|
flot = fopen("iut.txt","w");
|
|
|
|
|
|
|
|
for (i = 0 ; i < tailleL ; i++) {
|
|
|
|
|
|
|
|
fprintf(flot,"%s\n",tabV[i]->ville);
|
|
|
|
|
|
|
|
fprintf(flot,"%d\n",longueurListe(tabV[i]->idDept));
|
|
|
|
|
|
|
|
SauvegarderListe(tabV[i]->idDept,flot);
|
|
|
|
|
|
|
|
free(tabV[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SauvegarderListe(ListeDept l, FILE* flot) {
|
|
|
|
|
|
|
|
MaillonDept* tmp;
|
|
|
|
|
|
|
|
while (l->suiv != NULL) {
|
|
|
|
|
|
|
|
tmp = l;
|
|
|
|
|
|
|
|
fprintf(flot,"%s %d %s\n",l->departement,l->nbPers,l->responsable);
|
|
|
|
|
|
|
|
l = l->suiv;
|
|
|
|
|
|
|
|
free(tmp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(flot,"%s %d %s\n",l->departement,l->nbPers,l->responsable);
|
|
|
|
|
|
|
|
free(l);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void clearpage(void)
|
|
|
|
void clearpage(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char entre;
|
|
|
|
char entre;
|
|
|
|