DEV/DEV1.1/TP15/chaine.c
2023-01-11 14:14:52 +01:00

37 lines
607 B
C

#include <stdio.h>
#include <stdlib.h>
#include "pile.h"
int main(int argc, char const *argv[])
{
pile *bazar;
char input1;
char input2;
printf(">");
scanf("%c%c",&input1,&input2);
while(input1!='q')
{
printf("input1=%c input2=%c\n", input1,input2);
if (input1=='+')
{
push(&bazar,input2);
printf("Le charactere %c a été ajouté\n", input2);
input1=' ';
}
else
{
if (input1=='-')
{
printf("Le charactere %c a été supprimé\n",pop(&bazar));
input1=' ';
}
else
{
printf(">");
scanf("%c%c",&input1,&input2);
}
}
}
printf("Au revoir\n");
return 0;
}