comp.lang.ada
 help / color / mirror / Atom feed
* My first solution
@ 2011-06-15  6:01 juanmiuk
  2011-06-15  6:09 ` juanmiuk
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: juanmiuk @ 2011-06-15  6:01 UTC (permalink / raw)


with Ada.Strings.Fixed;
use  Ada.Strings.Fixed;

procedure Test_2 is

     subtype My_Num is Integer range 1 .. 10;

     function Format_Num ( Width_Num  : Integer;
                                       The_Number : Integer ) return
String is

        Temp_Length : My_Num := My_Num'Image(The_Number)'Length;
        Separador      : String := (Width_Num - Temp_Length) * ' ';

        begin
             return (Separador & My_Num'Image(The_Number));
        end Format_Num;

begin
     for I in My_Num range 1 .. 10 loop
        declare
            Output : String := Format_Num(My_Num'Width, I);
        begin
            Text_IO.Put_Line(Output);
        end;
    end loop;
end Test_2;



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-15 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-15  6:01 My first solution juanmiuk
2011-06-15  6:09 ` juanmiuk
2011-06-15  6:39 ` Ludovic Brenta
2011-06-15 18:39 ` onox
2011-06-15 19:43 ` Jeffrey Carter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox