38 lines
629 B
C
38 lines
629 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);
|
||
|
fflush(stdin);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
printf("Au revoir\n");
|
||
|
return 0;
|
||
|
}
|