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

  1.                                        -- Chapter 13 - Program 2
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure Access2 is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.    package Flt_IO is new Text_IO.Float_IO(FLOAT);
  10.    use Flt_IO;
  11.  
  12.    type POINT_TO_INT is access INTEGER;
  13.    Index,Arrow : POINT_TO_INT;
  14.  
  15.    type POINT_TO_FLOAT is access FLOAT;
  16.    X,Y,Z : POINT_TO_FLOAT;
  17.  
  18. begin
  19.    Index := new INTEGER'(173);
  20.    Arrow := new INTEGER'(57);
  21.    Put("The values are");
  22.    Put(Index.all);
  23.    Put(Arrow.all);
  24.    New_Line;
  25.    Index.all := 13;
  26.    Arrow.all := Index.all;
  27.    Index := Arrow;
  28.  
  29.    X := new FLOAT'(3.14159);
  30.    Y := X;
  31.    Z := X;
  32.    Put("The float values are");
  33.    Put(X.all,6,6,0);
  34.    Put(Y.all,6,6,0);
  35.    Put(Z.all,6,6,0);
  36.    New_Line;
  37.  
  38.    X.all := 2.0 * Y.all;
  39.    Put("The float values are");
  40.    Put(X.all,6,6,0);
  41.    Put(Y.all,6,6,0);
  42.    Put(Z.all,6,6,0);
  43.    New_Line;
  44.  
  45. end Access2;
  46.  
  47.  
  48.  
  49.  
  50. -- Result of execution
  51.  
  52. -- The values are   173    57
  53. -- The float values are     3.141590     3.141590     3.141590
  54. -- The float values are     6.283180     6.283180     6.283180
  55.  
  56.