From: juanmiuk <juanmiuk@googlemail.com>
Subject: I need feedback
Date: Tue, 14 Jun 2011 14:12:38 -0700 (PDT)
Date: 2011-06-14T14:12:38-07:00 [thread overview]
Message-ID: <de54061a-6974-4767-bcfd-2e20fc180f33@v18g2000yqe.googlegroups.com> (raw)
My name is Juan Miguel and I have ADHD. Since I have long wanted to
learn Ada but I could not learn, because the medication was not
correct and I could not concentrate properly. I returned to writing
simple programs to get base. All I want is to tell me how I am doing.
Thanks in advance.
with Ada.Text_IO;
with Ada.Numerics.Discrete_Random;
with Ada.Strings.Fixed;
use Ada;
use Ada.Strings.Fixed;
procedure ordenar_3_numeros_better is
type UnoDiez is range 1 .. 10;
package Ruleta10 is new Ada.Numerics.Discrete_Random(UnoDiez);
Gen10: Ruleta10.Generator;
begin
Ruleta10.Reset(Gen10);
for I in 1 .. 10 loop
Proceso_Principal: declare
A : UnoDiez := Ruleta10.Random(Gen10);
B : UnoDiez := Ruleta10.Random(Gen10);
C : UnoDiez := Ruleta10.Random(Gen10);
First : UnoDiez;
Secon : UnoDiez;
Third : UnoDiez;
begin
Formateo_Salida_1: declare
Separador1 : String := (UnoDiez'Width - UnoDiez'Image(A)'Length) *
' ';
Separador2 : String := (UnoDiez'Width - UnoDiez'Image(B)'Length) *
' ';
Separador3 : String := (UnoDiez'Width - UnoDiez'Image(C)'Length) *
' ';
begin
Text_IO.Put (
Separador1 & UnoDiez'Image(A) & "," &
Separador2 & UnoDiez'Image(B) & "," &
Separador3 & UnoDiez'Image(C) & " --"
);
end Formateo_Salida_1;
if (A >= B) then
if (A >= C) then
First := A;
if (B >= C) then
-- First := A;
Secon := B;
Third := C;
else
-- First := A;
Secon := C;
Third := B;
end if;
else -- C > A >= B
First := C;
Secon := A;
Third := B;
end if;
elsif (B >= A) then
if (B >= C) then
First := B;
if (A >= C) then
-- First := B;
Secon := A;
Third := C;
else
-- First := B;
Secon := C;
Third := A;
end if;
else -- C > B >= A
First := C;
Secon := B;
Third := A;
end if;
end if;
Formateo_Salida_2: declare
Separador1 : String := (UnoDiez'Width -
UnoDiez'Image(First)'Length) * ' ';
Separador2 : String := (UnoDiez'Width -
UnoDiez'Image(Secon)'Length) * ' ';
Separador3 : String := (UnoDiez'Width -
UnoDiez'Image(Third)'Length) * ' ';
begin
Text_IO.Put (
Separador1 & UnoDiez'Image(First) & "," &
Separador2 & UnoDiez'Image(Secon) & "," &
Separador3 & UnoDiez'Image(Third)
);
Text_IO.New_Line;
end Formateo_Salida_2;
end Proceso_Principal;
end loop;
end ordenar_3_numeros_better;
next reply other threads:[~2011-06-14 21:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 21:12 juanmiuk [this message]
2011-06-14 21:50 ` I need feedback Ludovic Brenta
2011-06-15 9:10 ` Pascal Obry
2011-06-15 11:40 ` Yannick Duchêne (Hibou57)
2011-06-15 19:38 ` Shark8
2011-06-16 4:24 ` juanmiuk
2011-06-16 7:34 ` Ludovic Brenta
2011-06-14 23:16 ` 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