This commit is contained in:
Simon SAYE BABU 2023-01-11 15:30:03 +01:00
parent bfdbf7a373
commit 6d2c613a9c

View File

@ -1,37 +1,84 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <graph.h>
struct pile{ struct file{
char val; char val;
struct pile *suite; struct file *suite;
}; };
typedef struct pile pile; typedef struct file file;
int empty(pile* p){ int empty(file* f)
return p==NULL; {
return f==NULL;
} }
void push(pile **p, char v){ void push(file **f, char v){
pile *new=malloc(sizeof(pile)); if ((*f)->val=='\0')
new->val=v; {
new->suite=*p; (*f)->val=v;
*p=new; }
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 pop(file **f){
char v=(*p)->val; char v=(*f)->val;
pile *temp=*p; file *temp=*f;
*p=(*p)->suite; *f=(*f)->suite;
free(temp); free(temp);
return v; return v;
} }
void clear(pile **p){ void clear(file **f){
while(!empty(*p)){ while(!empty(*f)){
pop(p); pop(f);
} }
} }
char top(pile **p){ char first(file **f){
return (*p)->val; 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;
} }