* Ada problem
@ 2004-11-14 23:47 ada_newbie
2004-11-15 1:08 ` Larry Hazel
0 siblings, 1 reply; 4+ messages in thread
From: ada_newbie @ 2004-11-14 23:47 UTC (permalink / raw)
Hello,
i'm new to ada and i have a simple problem. I don't know how to get an
output of enumeration types. The following example doesn't work:
with Ada.Text_IO;
procedure values is
type Days is (monday, tuesday, wednesday);
begin
Ada.Text_IO.Put(Days'First);
end values;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada problem
2004-11-14 23:47 Ada problem ada_newbie
@ 2004-11-15 1:08 ` Larry Hazel
2004-11-15 1:15 ` Sandro Magi
0 siblings, 1 reply; 4+ messages in thread
From: Larry Hazel @ 2004-11-15 1:08 UTC (permalink / raw)
ada_newbie wrote:
> Hello,
>
> i'm new to ada and i have a simple problem. I don't know how to get an
> output of enumeration types. The following example doesn't work:
>
>
> with Ada.Text_IO;
>
> procedure values is
>
> type Days is (monday, tuesday, wednesday);
>
> begin
Ada.Text_IO.Put(Days'Image(Days'First));
> end values;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada problem
2004-11-15 1:08 ` Larry Hazel
@ 2004-11-15 1:15 ` Sandro Magi
2004-11-15 12:49 ` Marin David Condic
0 siblings, 1 reply; 4+ messages in thread
From: Sandro Magi @ 2004-11-15 1:15 UTC (permalink / raw)
Or:
with Ada.Text_IO.Enumeration_IO;
procedure values is
��type�Days�is�(monday,�tuesday,�wednesday);
��package�Days_IO�is
�����������������new�Ada.Text_IO.Enumeration_IO�(Days);
begin
��Days_IO.Put(Days'First);
end values;
Larry Hazel wrote:
> ada_newbie wrote:
>
>> Hello,
>>
>> i'm new to ada and i have a simple problem. I don't know how to get an
>> output of enumeration types. The following example doesn't work:
>>
>>
>> with Ada.Text_IO;
>>
>> procedure values is
>>
>>����type�Days�is�(monday,�tuesday,�wednesday);
>>
>> begin
>
>��������Ada.Text_IO.Put(Days'Image(Days'First));
>
>> end values;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada problem
2004-11-15 1:15 ` Sandro Magi
@ 2004-11-15 12:49 ` Marin David Condic
0 siblings, 0 replies; 4+ messages in thread
From: Marin David Condic @ 2004-11-15 12:49 UTC (permalink / raw)
Sandro Magi wrote:
> Or:
>
> with Ada.Text_IO.Enumeration_IO;
>
> procedure values is
> type Days is (monday, tuesday, wednesday);
> package Days_IO is
> new Ada.Text_IO.Enumeration_IO (Days);
> begin
>
> Days_IO.Put(Days'First);
>
> end values;
>
Note also that it is a bit easier to include a "use" clause for the
package instantiation:
with Ada.Text_IO.Enumeration_IO ;
procedure Values is
type Days is (Monday, Tuesday, Wednesday) ;
package
Days_IO
is new
Ada.Text_IO.Enumeration_IO (Days) ;
--
use Days_IO ;
--
begin
for X in Days'Range loop
Put (X) ;
end loop ;
end Values ;
MDC
--
======================================================================
Marin David Condic
I work for: http://www.belcan.com/
My project is: http://www.jsf.mil/NSFrames.htm
Send Replies To: m o d c @ a m o g
c n i c . r
"Power corrupts. Absolute power is kind of neat"
-- John Lehman, Secretary of the Navy 1981-1987
======================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-11-15 12:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-14 23:47 Ada problem ada_newbie
2004-11-15 1:08 ` Larry Hazel
2004-11-15 1:15 ` Sandro Magi
2004-11-15 12:49 ` Marin David Condic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox