The Ada Program: example_1.adb
1 -- example_1.adb: illustrate overloaded subprocedures
2
3 with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
4 use Ada, Ada.Text_IO;
5
6 procedure Example_1 is
7
8 procedure Show (Item: Integer) is
9 begin
10 Integer_Text_IO.Put (Item, Width=>7);
11 end Show;
12
13 procedure Show (Item_1, Item_2: Integer) is
14 begin
15 Integer_Text_IO.Put (Item_1, Width=>7);
16 Integer_Text_IO.Put (Item_2, Width=>7);
17 end Show;
18
19 procedure Show (Item: Float) is
20 begin
21 Float_Text_IO.Put (Item, Fore=>3, Aft=>3, Exp=>0);
22 end Show;
23
24 procedure Show (Item: String) is
25 begin
26 Text_IO.Put (Item);
27 end Show;
28
29 begin
30
31 Set_Col (17); Show (" ******"); Show (" ------"); New_Line;
32 Set_Col (17); Show (1,2); New_Line;
33 Set_Col (17); Show (4.12); Show (75.4381); New_Line;
34 Set_Col (17); Show (1_000); Show (32_000); New_Line;
35 Set_Col (17); Show (" ******"); Show (" ------"); New_Line;
36
37 end Example_1;