From 6d2c613a9c9100eec01e2524d95b7faa17ad81c9 Mon Sep 17 00:00:00 2001 From: Simon Saye Babu Date: Wed, 11 Jan 2023 15:30:03 +0100 Subject: [PATCH] file --- DEV1.1/TP15/file.c | 85 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/DEV1.1/TP15/file.c b/DEV1.1/TP15/file.c index f049fc8..0aa08af 100644 --- a/DEV1.1/TP15/file.c +++ b/DEV1.1/TP15/file.c @@ -1,37 +1,84 @@ #include #include +#include -struct pile{ +struct file{ char val; - struct pile *suite; + struct file *suite; }; -typedef struct pile pile; +typedef struct file file; -int empty(pile* p){ - return p==NULL; +int empty(file* f) +{ + return f==NULL; } -void push(pile **p, char v){ - pile *new=malloc(sizeof(pile)); - new->val=v; - new->suite=*p; - *p=new; +void push(file **f, char v){ + if ((*f)->val=='\0') + { + (*f)->val=v; + } + else + { + file *current = (*f)->suite; + while(current != NULL) + { + current= current ->suite; + } + file *new=malloc(sizeof(file)); + new->val=v; + current->suite=new; + } } -char pop(pile **p){ - char v=(*p)->val; - pile *temp=*p; - *p=(*p)->suite; +char pop(file **f){ + char v=(*f)->val; + file *temp=*f; + *f=(*f)->suite; free(temp); return v; } -void clear(pile **p){ - while(!empty(*p)){ - pop(p); +void clear(file **f){ + while(!empty(*f)){ + pop(f); } } -char top(pile **p){ - return (*p)->val; +char first(file **f){ + return (*f)->val; +} + +void quartDeCercle1(int x, int y) +{ + couleur c; + c=CouleurParComposante(0,255,0); + ChoisirCouleurDessin(c); + RemplirArc(x,y,200,200,0,90); + c=CouleurParNom("white"); + ChoisirCouleurDessin(c); + RemplirArc(x+50,y+50,100,100,0,90); +} + +void quartDeCercle2(int x, int y) +{ + couleur c; + c=CouleurParComposante(255,0,0); + ChoisirCouleurDessin(c); + RemplirArc(x-5,y,200,200,90,180); + c=CouleurParNom("white"); + ChoisirCouleurDessin(c); + RemplirArc(x+45,y+50,100,100,0,90); +} + +int main(int argc, char const *argv[]) +{ + file *test = malloc(sizeof(file)); + InitialiserGraphique(); + CreerFenetre(10,10,1000,1000); + quartDeCercle2(200,200); + Touche(); + FermerGraphique(); + + return 0; } \ No newline at end of file