The Ada Program: number.adb
1 -- number.adb: copy standard input to output and number the lines
2
3 with Text_IO, Ada.Integer_Text_IO;
4 use Ada;
5
6 procedure Number is
7
8 Line : String (1..100);
9 Length : Integer;
10 Line_Number : Positive := 1;
11
12 begin
13
14 while not (Text_IO.End_Of_File) loop
15 Text_IO.Get_Line (Line, Length);
16 Integer_Text_IO.Put (Line_Number, Width=>3);
17 Text_IO.Set_Col (5);
18 Line_Number := Line_Number + 1;
19 Text_IO.Put_Line (Line (1..Length));
20 end loop;
21
22 end Number;