#include #include #include #include "iut.h" //Liste: VilleIUT initialiser (void){ VilleIUT V; V.Idept=NULL; V.Ville=NULL; return V; } Booleen testVide(VilleIUT V){ if(V.Ville==NULL) return vrai; return faux; } VilleIUT Enfiler(VilleIUT V, char *departement, int nbP,char *resp){ MaillonDept *m; m=(MaillonDept*)malloc(sizeof(MaillonDept)); if(m==NULL){printf("pb ouv malloc");exit(1);} strcpy(m->departement, departement); m->nbP=nbP; strcpy(m->resp,resp); m->suivant=NULL; if(testVide(V)){ V.Ville=m; V.Idept=m; } else{ V.Idept->suivant=m; V.Idept=m; } return V; } VilleIUT defiler(VilleIUT V){ MaillonDept *temp; if(testVide(V)){ printf("testVide"); return V; } temp=V.Ville; V.Ville=temp->suivant; free(temp); if(V.Ville==NULL) V.Idept=NULL; return V; } void afficher (VilleIUT V){ if(testVide(V)) return; printf("\n%s\t",V.Ville->departement); printf("%d\t",V.Ville->nbP); printf("%s\t",V.Ville->resp); V.Ville=V.Ville->suivant; afficher(V); }