Yurttas/PL/IL/Ada-95/ProgUnits/G/ex 03.adb

From ZCubes Wiki
Jump to navigation Jump to search
 1--
 2-- Copyright (C) 1998
 3-- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4--
 5-- Permission to use, copy, modify, and distribute this
 6-- software and its documentation for EDUCATIONAL purposes
 7-- and without fee is hereby granted provided that this
 8-- copyright notice appears in all copies.
 9--
10--
11 
12-- date   : January 1, 1998.
13-- author : Salih Yurttas.
14
15-- purpose : to demonstrate a procedure/package structures which
16--           are the units of Ada-95 programming structuring and
17--           composition.
18
19-- ex_03.adb
20
21
22with Text_IO; use Text_IO;
23
24procedure EX_03 is 
25
26  package Int_IO is new Integer_IO(Integer); use Int_IO;
27
28  A : Integer := 1;
29  B : Integer := 5;
30
31  X : Integer := 2;
32  Y : Integer := 8;
33
34  T : Integer;
35
36begin
37
38  New_Line;
39  Put_Line("A-B before / ");
40
41  Put(A,1);
42  New_Line;
43
44  Put(B,1);
45  New_Line;
46
47  T := A;
48  A := B;
49  B := T;
50
51  New_Line;
52  Put_Line("A-B after / ");
53
54  Put(A,1);
55  New_Line;
56
57  Put(B,1);
58  New_Line;
59
60  New_Line;
61
62  New_Line;
63  Put_Line("X-Y before / ");
64
65  Put(X,1);
66  New_Line;
67
68  Put(Y,1);
69  New_Line;
70
71  T := X;
72  X := Y;
73  Y := T;
74
75  New_Line;
76  Put_Line("X-Y after / ");
77
78  Put(X,1);
79  New_Line;
80
81  Put(Y,1);
82  New_Line;
83
84end EX_03;