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 void affichageListeDept(ListeDept l) // itératif
{ {
printf("DEPARTEMENT NOMBRE DE PLACES CHEF\n");
while (l != NULL) while (l != NULL)
{ {
printf("%s\t%d\t%s\n", l->departement, l->nbPlaces, l->nom); 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; return l;
} }
// ListeDept supprimerEnTête(ListeDept l) ListeDept supprimerEnTête(ListeDept l)
// { {
// MaillonDept *aux; MaillonDept *aux;
// if (l == NULL) if (l == NULL)
// { {
// printf("suppression interdite\n"); printf("suppression interdite\n");
// exit(1); exit(1);
// } }
// if (l->suiv == NULL) if (l->suiv == NULL)
// return NULL; return NULL;
// aux = l; aux = l;
// l = l->suiv; l = l->suiv;
// free(aux); free(aux);
// return l; 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;
// }
// void affichageListeDeptR(ListeDept l) ListeDept supprimer(ListeDept l, char *code)
// { {
// if (l->suiv == NULL) if (l == NULL)
// printf("%d\n", l->v); return l;
// printf("%d =>", l->v); if ((strcmp(code,l->departement)) < 0)
// affichageListeDeptR(l->suiv); return l;
// } if ((strcmp(code,l->departement)) == 0)
return supprimerEnTête(l);
l->suiv = supprimer(l->suiv, code);
return l;
}
// int tete(ListeDept l) /*
// { void affichageListeDeptR(ListeDept l)
// if (l == NULL) {
// { if (l->suiv == NULL)
// printf("opération interdite\n"); printf("%d\n", l->v);
// exit(1); printf("%d =>", l->v);
// } affichageListeDeptR(l->suiv);
// return l->v; }
// }
// bool vide(ListeDept l)
// {
// if (l == NULL)
// return true; // 1
// return false; // 0
// }
// int longueur(ListeDept l) int tete(ListeDept l)
// { {
// int cpt = 0; if (l == NULL)
// while (l != NULL) {
// { printf("opération interdite\n");
// cpt + 1; exit(1);
// l = l->suiv; }
// } return l->v;
// return cpt; }
// } */
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[]) bool rechercheDept(ListeDept l, char code[])
{ {
@ -192,10 +194,12 @@ bool rechercheDept(ListeDept l, char code[])
return recherche(l->suiv, x); return recherche(l->suiv, x);
} }
// ListeDept ajouterEnQueue(ListeDept l, int x) /*
// { ListeDept ajouterEnQueue(ListeDept l, int x)
// if (l == NULL) {
// return ajouterEnTête(l, x); if (l == NULL)
// l->suiv = ajouterEnQueue(l->suiv, x); return ajouterEnTête(l, x);
// return l; l->suiv = ajouterEnQueue(l->suiv, x);
// } return l;
}
*/
Loading…
Cancel
Save