include stdio include conio struct dstack char el dstack next void ins

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <stdio.h>
#include <conio.h>
struct dstack
{char el;
dstack *next;};
void instack (char x, dstack **S)
{
dstack *r;
r = new dstack;
r->el = x;
r->next=*S;
*S=r;
}
int pust (dstack *S)
{
if (S==NULL) return 1;
return 0;
}
int outstack(char *x, dstack **S)
{
dstack *r;
int t;
t=pust (*S);
if (t==0)
{r=*S; *x=r->el;
*S=r->next;
delete r;
return 1;
}
return 0;
}
void newstack (dstack **S)
{
*S=NULL;
}
/*void prosmotr (dstack **S)
{
dstack *r;
newstack (&r);
while (pust (*S)!=1)
{int q;
int x;
q=outstack (&x, S);
printf ("%d ", x);
instack (x, &r);
}
while (pust (r)!=1)
{int q;
int x;
q=outstack (&x, &r);
instack (x, S);
}
}*/