DEV/DEV1.1/TP15/chaine.c

38 lines
629 B
C
Raw Normal View History

2023-01-04 15:31:14 +01:00
#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);
fflush(stdin);
}
}
}
printf("Au revoir\n");
return 0;
}