home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / automatc.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.4 KB  |  52 lines

  1.                                      -- Chapter 9 - Program 4
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure Automatc is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    Dog, Cat : INTEGER;
  11.    Pig, Cow : FLOAT;
  12.  
  13. begin
  14.  
  15.    for Index in 1..10 loop
  16.       Put("The value of Index is");
  17.       Put(Index,3);
  18.  
  19.       declare
  20.          START : constant INTEGER := Index;
  21.          STOP  : constant INTEGER := START + 5;
  22.          Count_Stuff : INTEGER;
  23.       begin
  24.          Count_Stuff := START + STOP + Index + 222;
  25.          Put(" --->");
  26.          for Index in START..STOP loop
  27.             Put(Index,5);
  28.          end loop;
  29.       end;
  30.  
  31.       New_Line;
  32.    end loop;
  33.  
  34. end Automatc;
  35.  
  36.  
  37.  
  38.  
  39. -- Result of execution
  40.  
  41. -- The value of Index is  1 --->    1    2    3    4    5    6
  42. -- The value of Index is  2 --->    2    3    4    5    6    7
  43. -- The value of Index is  3 --->    3    4    5    6    7    8
  44. -- The value of Index is  4 --->    4    5    6    7    8    9
  45. -- The value of Index is  5 --->    5    6    7    8    9   10
  46. -- The value of Index is  6 --->    6    7    8    9   10   11
  47. -- The value of Index is  7 --->    7    8    9   10   11   12
  48. -- The value of Index is  8 --->    8    9   10   11   12   13
  49. -- The value of Index is  9 --->    9   10   11   12   13   14
  50. -- The value of Index is 10 --->   10   11   12   13   14   15
  51.  
  52.