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

  1.                                        -- Chapter 3 - Program 3
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure InitEx is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    Index_1, Index_2, Index_3    : INTEGER;
  11.    This_Is_A_Long_Variable_Name : INTEGER;
  12.  
  13.    DOZEN  : constant INTEGER := 12;
  14.    GROSS  : constant INTEGER := 12 * DOZEN;
  15.    BIG_NO : constant         := 32_24_7;           -- This is 32247
  16.    TWO    : constant         := BIG_NO - 3_22_45;  -- This is 2
  17.  
  18. begin
  19.  
  20.    Index_1 := GROSS;                    -- Index_1 is 144
  21.    Index_2 := BIG_NO - TWO;             -- Index_2 is 32245
  22.    Index_3 := TWO * GROSS;              -- Index_3 is 288
  23.    This_Is_A_Long_Variable_Name := DOZEN * DOZEN - GROSS;
  24.    Put("Index_1 = "); Put(Index_1); New_Line;
  25.    Put("Index_2 = "); Put(Index_2); New_Line;
  26.    Put("Index_3 = "); Put(Index_3); New_Line;
  27.    Put("This_Is_A_Long_Variable_Name =");
  28.    Put(This_Is_A_Long_Variable_Name); New_Line;
  29.  
  30.    Index_1 := 123E2;                    -- 12300
  31.    Index_2 := 1_23e2;                   -- 12300
  32.    Index_3 := 12_3e+2;                  -- 12300
  33.    Index_1 := 2#10111#;                 -- Binary number
  34.    Index_2 := 8#377#;                   -- Octal number
  35.    Index_3 := 16#1FF#e1;                -- Hexadecimal number
  36.    Index_1 := 12#A4#;                   -- Base 12 number
  37.  
  38. end InitEx;
  39.  
  40.  
  41.  
  42.  
  43. -- Result of execution
  44.  
  45. -- Index_1 =    144
  46. -- Index_2 =  32245
  47. -- Index_3 =    288
  48. -- This_Is_A_Long_Variable_Name =     0
  49.  
  50.