uses SysUtils Windows type TNodePtr TNode TNode record item word next

 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
uses
SysUtils, Windows;
type
TNodePtr=^TNode;
TNode = record
item:word;
next:TNodePtr;
end;
var
head,cur:TNodePtr;
a:Word;
choice:Word;
procedure CreateSpysok;
begin
SetConsoleCP (1251);
SetConsoleOutputCP (1251);
head:=nil;
Writeln;
write('Ââåä³òü ÷èñëî. Äëÿ çàê³í÷åííÿ ââåä³òü íóëü: ');
read(a);
while a<>0 do
begin
New(Cur);
cur^.item:=a;
cur^.next:=head;
head:=cur;
write('Ââåä³òü ÷èñëî. Äëÿ çàê³í÷åííÿ ââåä³òü íóëü: ');
read(a);
end;
end;
procedure ViewSpysok;
begin
Writeln('Ñïèñîê');
cur:=head;
while cur<>nil do
begin
Writeln(cur^.item);
cur:=cur^.next;
end;
end;
begin
Writeln('1. Ñòâîðèòè ñïèñîê.');
Writeln('2. Ïåðåãëÿíóòè ñïèñîê.');
Writeln('3. Âèéòè.');
Writeln;
write('Ââåä³òü ïóíêò ìåíþ: ');
Readln(choice);
while choice<>3 do
begin
if choice=1 then
CreateSpysok;
if choice=2 then
begin
Writeln;
Writeln;
ViewSpysok;
end;
Writeln;
Writeln('1. Ñòâîðèòè ñïèñîê.');
Writeln('2. Ïåðåãëÿíóòè ñïèñîê.');
Writeln('3. Âèéòè.');
Writeln;
write('Ââåä³òü ïóíêò ìåíþ: ');
Readln(choice);
end;
Readln;
end.