The Ada Program: convert.adb

  1 -- convert.adb:  convert command line string to float
  2 
  3 with
  4   Ada.Command_Line,   -- access to external execution env (Ada95 A.15)
  5   Ada.Text_IO,        -- usual text (Latin 1) input/output (A.10.1)
  6   Ada.Float_Text_IO;  -- preinstantiated generic for Float IO
  7 use Ada;
  8 
  9 procedure Convert is
 10    S : constant String := Command_Line.Argument (1);
 11    F : Float;
 12    L : Positive;
 13 begin
 14    Float_Text_IO.Get (From=>S, Item=>F, Last=>L);
 15    Float_Text_IO.Put (Item=>F, Aft=>4, Exp=>0);
 16    Text_IO.New_Line;
 17 end Convert;