home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / answers / ch14_2.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  719 b   |  40 lines

  1.                          -- Chapter 14 - Programming exercise 2
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure FloatIn is
  6.  
  7.    package Flt_IO is new Text_IO.Float_IO(FLOAT);
  8.    use Flt_IO;
  9.  
  10.    Float_File : FILE_TYPE;
  11.    Float_Dat  : FLOAT;
  12.  
  13. begin
  14.  
  15.    Open(Float_File,In_File,"FLTDATA.TXT");
  16.  
  17.    while not End_Of_File(Float_File) loop
  18.       if End_Of_Line(Float_File) then
  19.          New_Line;
  20.          Skip_Line(Float_File);
  21.       else
  22.          Get(Float_File,Float_Dat);
  23.          Put("The value read in is");
  24.          Put(Float_Dat);
  25.          New_Line;
  26.       end if;
  27.    end loop;
  28.  
  29.    Close(Float_File);
  30.  
  31. end FloatIn;
  32.  
  33.  
  34.  
  35.  
  36. -- Result of execution
  37.  
  38. -- (The output depemds on the input values.)
  39.  
  40.