You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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);
}