-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrecord4.adb
64 lines (55 loc) · 1.39 KB
/
record4.adb
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
with Ada.Text_IO; use Ada.Text_IO;
procedure Record4 is
type R is record A, B: Character; end record;
type S is record C: Character; D: R; E: Character; end record;
V, W: R;
X, Y: S;
procedure PrintR(x: R) is
begin
Put('[');
Put(x.A);
Put(',');
Put(x.B);
Put(']');
end;
procedure PrintS(x: S) is
begin
Put('[');
Put(x.C);
Put(',');
PrintR(x.D);
Put(',');
Put(x.E);
Put(']');
end;
begin
V.A := '1';
V.B := '2';
X.C := '0';
X.D := V;
X.E := '3';
W.A := 'b';
W.B := 'c';
Y.C := 'a';
Y.D := W;
Y.E := 'd';
PrintS(X); New_Line;
PrintS(Y); New_Line;
if X = Y then Put('*'); else Put('.'); end if;
if X.D = W then Put('*'); else Put('.'); end if;
if X.D = Y.D then Put('*'); else Put('.'); end if;
if X.D.A = Y.D.A then Put('*'); else Put('.'); end if;
X.D := Y.D;
if X.D = W then Put('*'); else Put('.'); end if;
if X.D = Y.D then Put('*'); else Put('.'); end if;
if X.D.A = Y.D.A then Put('*'); else Put('.'); end if;
X := Y;
if X = Y then Put('*'); else Put('.'); end if;
if X.D = W then Put('*'); else Put('.'); end if;
if X.D = Y.D then Put('*'); else Put('.'); end if;
if X.D.A = Y.D.A then Put('*'); else Put('.'); end if;
New_Line;
end Record4;
-- Local Variables:
-- compile-command: "gnatmake record4.adb && ./record4"
-- End: