From cdc968af29a0dd843caabc2f553fc2d9f8d20195 Mon Sep 17 00:00:00 2001 From: Olougouna Axel Date: Wed, 7 Dec 2022 11:12:11 +0100 Subject: [PATCH] =?UTF-8?q?on=20peut=20r=C3=A9cup=C3=A9rer=20entier=20ou?= =?UTF-8?q?=20float?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 14 +++++++------- pile.c | 12 ++++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index d48877a..71f3277 100644 --- a/main.c +++ b/main.c @@ -6,22 +6,22 @@ int main(int argc, char * argv[]) { - /*struct Pile P; + struct Pile P; Init_Pile(&P); - Empiler(&P, '4'); - Empiler(&P, '5'); - struct Cell * res = Depiler(&P); + Empiler(&P, "4"); + Empiler(&P, "1.0"); + //struct Cell * res = Depiler(&P); //Supprimer(&P); Affichage(P.Pil); - Affiche_Nombre(res->Ent);*/ + //Affiche_Nombre(res->Ent); - Programme * P; + /*Programme * P; P = lexer(argv[1]); for(int i=0; itaille; i++) { printf("TOKEN : %s \n", P->tokens[i]); - } + }*/ /*for(int i=0; iProg->taille; i++) { diff --git a/pile.c b/pile.c index 89f41f4..1671fe3 100644 --- a/pile.c +++ b/pile.c @@ -45,9 +45,17 @@ void Empiler(struct Pile * P, char * nb) struct Nombre i = Typenum(nb); if (i.typ == Entier) - cel->Ent.nombr.ValEntier = i.nombr.ValEntier; + { + //cel->Ent.nombr.ValEntier = i.nombr.ValEntier; + //cel->Ent.typ = Entier; + cel->Ent = i; + } else if (i.typ == Reel) - cel->Ent.nombr.ValReel = i.nombr.ValReel; + { + //cel->Ent.nombr.ValReel = i.nombr.ValReel; + //cel->Ent.typ = Reel; + cel->Ent = i; + } cel->Suiv = P->Pil; P->Pil = cel; P->nbElements +=1;