From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Ada code snippet help (array of arrays)
Date: Wed, 13 May 2009 16:25:26 +0200
Date: 2009-05-13T16:25:26+02:00 [thread overview]
Message-ID: <4a0ad856$0$31874$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <b6f7e019-522b-4eb8-9bb3-ae920d98a06d@n21g2000vba.googlegroups.com>
Vamp4L schrieb:
> Trying to figure out why my code doesn't work
> This line in particular doesn't compile "if Theater(Seat)(reserved) =
> F then" :
>
> with Ada.Text_Io; use Ada.Text_Io;
> procedure Ch4Ex22 is
> package Int_Io is new Integer_Io(Integer);
> use Int_Io;
> package Boolean_Io is new Enumeration_Io(Boolean);
> use Boolean_Io;
>
> T: constant Boolean := True;
> F: constant Boolean := False;
> type Seatattributes is (Reserved, Balcony);
> type SeatType is array(SeatAttributes) of Boolean;
> type Theater is array (1..50) of SeatType;
> A: Theater := (1=>(T,F),2..7=>(F,F),8=>(T,F),9..15=>(F,F),16=>
> (T,F),
> 17..23=>(F,F),24=>(T,F),25..29=>(F,F),30..31=>(F,T),32=>(T,T),
> 33..49=>(F,T),50=>(T,T));
>
> begin
>
> for Seat in Theater'range loop
> if Theater(Seat)(reserved) = F then
"Theater" is the name of a type. I guess you meant
the array object A?
> Put(Seat, 1); New_Line;
> end if;
> end loop;
>
> end Ch4Ex22;
--
--
Georg Bauhaus
Y A Time Drain http://www.9toX.de
next prev parent reply other threads:[~2009-05-13 14:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-13 14:11 Ada code snippet help (array of arrays) Vamp4L
2009-05-13 14:25 ` Georg Bauhaus [this message]
2009-05-13 14:28 ` Vamp4L
2009-05-13 15:05 ` Jacob Sparre Andersen
2009-05-14 8:05 ` Egil Høvik
2009-05-14 15:16 ` Adam Beneschan
2009-05-14 17:14 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox