comp.lang.ada
 help / color / mirror / Atom feed
From: "conchale@mac.com" <conchale@mac.com>
Subject: Printing out an Array
Date: 31 Jan 2005 06:43:05 -0800
Date: 2005-01-31T06:43:05-08:00	[thread overview]
Message-ID: <1107182585.066205.21490@f14g2000cwb.googlegroups.com> (raw)

Hello all, I'm new to this and comming from Java environment.  I have
this code to convert bytes to bits but I dont know what to put in the
last line of code to get on the screen my converted number.  Thanks for
any help
----------------------------------------------------------
with Ada.Text_Io; use Ada.Text_Io;
with Ada.Integer_text_Io; use Ada.Integer_text_Io;

procedure Pas3 is

subtype Octet is Integer range 0..255;
subtype Bit   is Integer range 0..1;
type Tab_Bits is array (0 .. 7) of Bit;

function Octet_Vers_Bits (Oc : Octet )
return Tab_Bits is
Resultat : Tab_Bits;
N        : Octet;

begin
N := Oc;
for I in reverse 0..7 loop
if ( N mod 2 = 1 ) then
Resultat(I) := 1;
else
Resultat(I) := 0;
end if;
N := N / 2;
end loop;
return Resultat;
end Octet_Vers_Bits;

t1 : Tab_bits;
x : integer;

begin
Put (" donner x: ");
Get(x);


for I in 0 .. 7 loop
t1 := Octet_Vers_Bits(x);
Put(Bit(x)); ----------------> here is the problem, what should I
put here.
   end loop;
end Pas3 ;




             reply	other threads:[~2005-01-31 14:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-31 14:43 conchale [this message]
2005-01-31 15:00 ` Printing out an Array Martin Krischik
2005-02-01  3:05 ` Jeffrey Carter
2005-02-01  3:14 ` Steve
replies disabled

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