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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
| program lab2;
uses crt;
const lo=15; ls=10;
type st15=string[15];
ms=array[1..10] of st15;
var is,io,nm:integer;
a:st15; st,och:ms;
procedure inp_a(var s:st15);
begin
write('a=');readln(s);end;
procedure out_a(var s:st15);
begin
writeln('a=',a);end;
procedure dop_st(a:st15; ls:integer; var is:integer; var st:ms);
begin is:=is+1;
st[is]:=a;
end;
procedure dop_och(a:st15; ls:integer; var is:integer; var st:ms);
begin is:=is+1;
st[is]:=a;
end;
procedure from_st(var a:st15; ls:integer; var is:integer; var st:ms);
begin a:=st[is];
st[is]:=' ';
is:=is-1;
end;
procedure from_och(var a:st15; ls:integer; var is:integer; var st:ms);
var i:integer;
begin a:=st[1];
for i:=1 to is-1 do;
st[i]:=st[i+1];
st[is]:=' ';
is:=is-1;
end;
procedure out_st(a:string; is:integer; st:ms);
var i:integer;
begin
writeln(a);
for i:=1 to is do
writeln(st[i]);
end;
BEGIN
is:=0; io:=0; a:=' ';
repeat
window(1,1,80,25); clrscr;
gotoxy(25,15);
out_a(a);
window(1,1,20,25);
out_st('stek',is,st);
window(61,1,80,25);
out_st('och',io,och);
window(26,1,55,12);
writeln('1-con->a');
writeln('2-a->stek');
writeln('3-stek->a');
writeln('4-a->och');
writeln('5-och->a');
write('input 1-8');
readln(nm);
case nm of
1:inp_a(a);
2:if is=ls then begin writeln('Stek p');
write('press');
readln;
end;
else dop_st(a,ls,is,st);end;
3:begin if is=0 then begin writeln('Stek p');
write('press');
readln;
end;
else from_st(a,ls,is,st);end;end;
4:if io=lo then begin writeln('och p');
write('press');
readln;
end;
else dop_och(a,lo,io,och);end;
5:if io=0 then begin writeln('och p');
write('press');
readln;
end;
else from_och(a,lo,io,och);
end;
END. |