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

  1.                                        -- Chapter 14 - Program 6
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure IntIn is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    Integer_File : FILE_TYPE;
  11.    Index        : INTEGER;
  12.  
  13. begin
  14.  
  15.    Open(Integer_File,In_File,"INTDATA.TXT");
  16.  
  17.    while not End_Of_File(Integer_File) loop
  18.       if End_Of_Line(Integer_File) then
  19.          New_Line;
  20.          Skip_Line(Integer_File);
  21.       else
  22.          Get(Integer_File,Index);
  23.          Put("The value read in is");
  24.          Put(Index);
  25.          New_Line;
  26.       end if;
  27.    end loop;
  28.  
  29.    Close(Integer_File);
  30.  
  31. end IntIn;
  32.  
  33.  
  34.  
  35.  
  36. -- Result of execution
  37.  
  38. -- The value read in is    15
  39. -- The value read in is    16
  40. -- The value read in is    17
  41. -- The value read in is    18
  42. -- The value read in is    19
  43. --
  44. -- The value read in is    16
  45. -- The value read in is    17
  46. -- The value read in is    18
  47. -- The value read in is    19
  48. -- The value read in is    20
  49. --
  50. -- The value read in is    17
  51. -- The value read in is    18
  52. -- The value read in is    19
  53. -- The value read in is    20
  54. -- The value read in is    21
  55.  
  56.