home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LANGUAGE / ADA / LOVELACE / unbound.adb < prev    next >
Text File  |  1996-10-01  |  745b  |  33 lines

  1.  
  2. with Ada.Strings.Unbounded, Ustrings,
  3.       Text_IO, Ada.Integer_Text_IO;
  4. use  Ada.Strings.Unbounded, Ustrings,
  5.       Text_IO, Ada.Integer_Text_IO;
  6.  
  7. procedure Unbound is -- Demonstrate Unbounded_String.
  8.   Input : Unbounded_String;
  9.   Stop  : constant Unbounded_String := To_Unbounded_String("stop");
  10. begin
  11.   Put_Line("Please type 'stop' to end this program.");
  12.  
  13.   loop
  14.     New_Line;
  15.     Put_Line("Please type in a line:");
  16.     Get_Line(Input);
  17.  
  18.   exit when (Input = Stop);
  19.  
  20.     Put("You just typed in:"); Put_Line(Input);
  21.  
  22.     Put("This input line contains ");
  23.     Put(Length(Input));
  24.     Put_Line(" characters.");
  25.  
  26.     for I in reverse 1 .. Length(Input) loop
  27.       Put(Element(Input, I));
  28.     end loop;
  29.     New_Line;
  30.  
  31.   end loop;
  32. end Unbound;
  33.