modification des fonction de base (SAEl.c)

master
Alexis LAURENT 2 years ago
parent dde1d7d164
commit aa19f5eac5

138
SAEl.c

@ -97,7 +97,6 @@ ListeDept ajouterEnTete(ListeDept l, char *dept, char *nom, int nbP)
void affichageListeDept(ListeDept l) // itératif
{
printf("DEPARTEMENT NOMBRE DE PLACES CHEF\n");
while (l != NULL)
{
printf("%s\t%d\t%s\n", l->departement, l->nbPlaces, l->nom);
@ -117,69 +116,72 @@ ListeDept inserer(ListeDept l, char *dept, char *nom, int nbP)
return l;
}
// ListeDept supprimerEnTête(ListeDept l)
// {
// MaillonDept *aux;
// if (l == NULL)
// {
// printf("suppression interdite\n");
// exit(1);
// }
// if (l->suiv == NULL)
// return NULL;
// aux = l;
// l = l->suiv;
// free(aux);
// return l;
// }
// ListeDept supprimer(ListeDept l, int x)
// {
// if (l == NULL)
// return l;
// if (x < l->v)
// return l; // si VRAI x ne peut pas se trouver dans la ListeDept
// if (l->v == x)
// return supprimerEnTête(l);
// l->suiv = supprimer(l->suiv, x);
// return l;
// }
ListeDept supprimerEnTête(ListeDept l)
{
MaillonDept *aux;
if (l == NULL)
{
printf("suppression interdite\n");
exit(1);
}
if (l->suiv == NULL)
return NULL;
aux = l;
l = l->suiv;
free(aux);
return l;
}
// void affichageListeDeptR(ListeDept l)
// {
// if (l->suiv == NULL)
// printf("%d\n", l->v);
// printf("%d =>", l->v);
// affichageListeDeptR(l->suiv);
// }
ListeDept supprimer(ListeDept l, char *code)
{
if (l == NULL)
return l;
if ((strcmp(code,l->departement)) < 0)
return l;
if ((strcmp(code,l->departement)) == 0)
return supprimerEnTête(l);
l->suiv = supprimer(l->suiv, code);
return l;
}
// int tete(ListeDept l)
// {
// if (l == NULL)
// {
// printf("opération interdite\n");
// exit(1);
// }
// return l->v;
// }
/*
void affichageListeDeptR(ListeDept l)
{
if (l->suiv == NULL)
printf("%d\n", l->v);
printf("%d =>", l->v);
affichageListeDeptR(l->suiv);
}
// bool vide(ListeDept l)
// {
// if (l == NULL)
// return true; // 1
// return false; // 0
// }
// int longueur(ListeDept l)
// {
// int cpt = 0;
// while (l != NULL)
// {
// cpt + 1;
// l = l->suiv;
// }
// return cpt;
// }
int tete(ListeDept l)
{
if (l == NULL)
{
printf("opération interdite\n");
exit(1);
}
return l->v;
}
*/
bool vide(ListeDept l)
{
if (l == NULL)
return true; // 1
return false; // 0
}
/*
int longueur(ListeDept l)
{
int cpt = 0;
while (l != NULL)
{
cpt + 1;
l = l->suiv;
}
return cpt;
}
*/
bool rechercheDept(ListeDept l, char code[])
{
@ -192,10 +194,12 @@ bool rechercheDept(ListeDept l, char code[])
return recherche(l->suiv, x);
}
// ListeDept ajouterEnQueue(ListeDept l, int x)
// {
// if (l == NULL)
// return ajouterEnTête(l, x);
// l->suiv = ajouterEnQueue(l->suiv, x);
// return l;
// }
/*
ListeDept ajouterEnQueue(ListeDept l, int x)
{
if (l == NULL)
return ajouterEnTête(l, x);
l->suiv = ajouterEnQueue(l->suiv, x);
return l;
}
*/
Loading…
Cancel
Save