DEV/DEV1.1/TP15/file.c

84 lines
1.3 KiB
C
Raw Normal View History

2023-01-11 14:14:52 +01:00
#include <stdio.h>
#include <stdlib.h>
2023-01-11 15:30:03 +01:00
#include <graph.h>
2023-01-11 14:14:52 +01:00
2023-01-11 15:30:03 +01:00
struct file{
2023-01-11 14:17:24 +01:00
char val;
2023-01-11 15:30:03 +01:00
struct file *suite;
2023-01-11 14:14:52 +01:00
};
2023-01-11 15:30:03 +01:00
typedef struct file file;
2023-01-11 14:14:52 +01:00
2023-01-11 15:30:03 +01:00
int empty(file* f)
{
return f==NULL;
2023-01-11 14:14:52 +01:00
}
2023-01-11 15:30:03 +01:00
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;
}
2023-01-11 14:14:52 +01:00
}
2023-01-11 15:30:03 +01:00
char pop(file **f){
char v=(*f)->val;
file *temp=*f;
*f=(*f)->suite;
2023-01-11 14:17:24 +01:00
free(temp);
return v;
2023-01-11 14:14:52 +01:00
}
2023-01-11 15:30:03 +01:00
void clear(file **f){
while(!empty(*f)){
pop(f);
2023-01-11 14:14:52 +01:00
}
2023-01-11 14:17:24 +01:00
}
2023-01-11 15:30:03 +01:00
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;
2023-01-11 14:14:52 +01:00
}