comp.lang.ada
 help / color / mirror / Atom feed
From: juanmiuk <juanmiuk@googlemail.com>
Subject: My first solution
Date: Tue, 14 Jun 2011 23:01:08 -0700 (PDT)
Date: 2011-06-14T23:01:08-07:00	[thread overview]
Message-ID: <3420583b-a063-4634-9989-580888e38eee@f2g2000yqh.googlegroups.com> (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;



             reply	other threads:[~2011-06-15  6:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15  6:01 juanmiuk [this message]
2011-06-15  6:09 ` My first solution juanmiuk
2011-06-15  6:39 ` Ludovic Brenta
2011-06-15 18:39 ` onox
2011-06-15 19:43 ` Jeffrey Carter
replies disabled

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