Modification des Makefile

master
Yann CHAMPEAU 3 years ago
commit 15b4b3db9a

@ -0,0 +1,11 @@
PHONY : clean doc all
all : prog
prog :
Make -C src all
doc :
Make -C src doc
clean :
Make -C src clean

Binary file not shown.

@ -14,3 +14,104 @@ void menu(void){
printf("A : Administrateur.\n\n"); printf("A : Administrateur.\n\n");
printf("#--------------------------------------------------------------------#\n"); printf("#--------------------------------------------------------------------#\n");
} }
//Pile
Pile creerpile(int tmax)
{
Pile p=(Pile)malloc(sizeof(pile));
p->tlogi=0;
p->tmax=tmax;
p->tab=(int*) malloc(tmax);
return p;
}
void empiler(Pile p, int x)
{
if (p->tmax==p->tlogi)
{
printf("Pile pleine");
return;
}
p->tab[p->tlogi++]=x;
}
void afficherPileEntier(Pile p)
{
for (int i=0; i<p->tlogi;i++) printf("%d\n",p->tab[i]);
}
int depiler(Pile p)
{
if (p->tlogi==0)
{
printf("Pile vide");
return -1;
}
return p->tab[--(p->tlogi)];
}
//File
File creerfile(int tmax)
{
File f=(File)malloc(sizeof(file));
Pile inipEntry=(Pile)malloc(sizeof(pile)/2);
Pile inipExit=(Pile)malloc(tmax-sizeof(pile)/2);
if (f==NULL || inipEntry==NULL || inipExit==NULL)
{
printf("Erreur maloc ini file\n");
exit(1);
}
inipEntry->tlogi=0;
inipEntry->tmax=tmax;
inipEntry->tab=(int*) malloc(tmax);
inipExit->tlogi=0;
inipExit->tmax=tmax-tmax/2;
inipExit->tab=(int*) malloc(tmax);
f->pEntry=inipEntry;
f->pExit=inipExit;
return f;
}
void vider_file(File f)
{
while (f->pExit->tmax!=f->pExit->tlogi && f->pEntry->tlogi!=0)
{
empiler(f->pExit,depiler(f->pEntry));
}
}
void enfiler(File f, int x)
{
if (f->pEntry->tlogi==f->pEntry->tmax)
{
vider_file(f);
}
f->pEntry->tab[f->pEntry->tlogi]=x;
f->pEntry->tlogi++;
}
int defiler(File f)
{
if (f->pExit->tlogi==0)
{
vider_file(f);
}
if (f->pExit->tlogi==0)
{
printf("File vide");
return -1;
}
f->pExit->tlogi--;
return f->pExit->tab[f->pExit->tlogi];
}
void afficherFileEntier(File f)
{
for(int i=0;i<f->pExit->tlogi;++i) printf("%d\n",f->pExit->tab[i]);
for(int i=f->pEntry->tlogi;i!=0;--i) printf("%d\n",f->pEntry->tab[i]);
}

@ -1 +1,42 @@
<<<<<<< HEAD
void menu(void); void menu(void);
=======
//Pile
typedef struct pile
{
int tlogi;
int tmax;
int* tab;
} pile;
typedef struct pile* Pile;
Pile creerpile(int tmax);
void empiler(Pile p, int x);
void afficherPileEntier(Pile p);
int depiler(Pile p);
//File
typedef struct file
{
Pile pEntry;
Pile pExit;
int* tab;
} file;
typedef struct file* File;
File creerfile(int tmax);
void enfiler(File f, int x);
void afficherFileEntier(File f);
int defiler(File f);
void vider_file(File f);
>>>>>>> edff24b7dc149a06522db6248ac41a7c23354fb6

@ -1 +1,13 @@
typedef struct MaillonDep
{
char departement[31];
int nbp;
char resp[51]
struct MaillonDep* suivant;
}MaillonDep;
typedef struct
{
char Ville[31];
MaillonDep* ldept;
}VilleIUT;

Loading…
Cancel
Save