* Re: Help, asking for code to print out an enumerated type [not found] <37008a4c-cdbf-42f4-b806-352501419ff6@n33g2000pri.googlegroups.com> @ 2008-11-21 16:37 ` Georg Bauhaus 2008-11-21 17:24 ` Anh Vo 1 sibling, 0 replies; 7+ messages in thread From: Georg Bauhaus @ 2008-11-21 16:37 UTC (permalink / raw) ChristopherL schrieb: > Today, I'm looking for someone to post all the code to print out an > enumerated type in Ada 83. Ideally, I would like a small program with > an enumerated variable containing code to print it out. I guess you can add to our enthusiam for giving "all the code" by alluding to the incentive you are offering. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, asking for code to print out an enumerated type [not found] <37008a4c-cdbf-42f4-b806-352501419ff6@n33g2000pri.googlegroups.com> 2008-11-21 16:37 ` Help, asking for code to print out an enumerated type Georg Bauhaus @ 2008-11-21 17:24 ` Anh Vo [not found] ` <c72d282b-044a-44ac-be29-de9de4188418@z27g2000prd.googlegroups.com> 2008-11-21 21:10 ` Jeffrey R. Carter 1 sibling, 2 replies; 7+ messages in thread From: Anh Vo @ 2008-11-21 17:24 UTC (permalink / raw) On Nov 21, 8:21 am, ChristopherL <clusard...@aol.com> wrote: > Hello everyone in Ada land, > > Today, I'm looking for someone to post all the code to print out an > enumerated type in Ada 83. Ideally, I would like a small program with > an enumerated variable containing code to print it out. > > Thank you, > Chris This code should work for all Ada including Ada 2005. I hope you get the idea to print any enumerated values. with Text_Io; procedure Print_Enum_Values is I_Prefer_Ada : Boolean := True; -- type Boolean is (True, False); defined in Standard begin Text_Io.Put_Line ("Are you prefer Ada? " & Boolean'Image (I_Prefer_Ada)); end Print_Enum_Values; ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <c72d282b-044a-44ac-be29-de9de4188418@z27g2000prd.googlegroups.com>]
* Re: Help, asking for code to print out an enumerated type [not found] ` <c72d282b-044a-44ac-be29-de9de4188418@z27g2000prd.googlegroups.com> @ 2008-11-21 18:12 ` Georg Bauhaus [not found] ` <04e810ee-d4f0-4947-b7c9-78790706d20f@s9g2000prg.googlegroups.com> 0 siblings, 1 reply; 7+ messages in thread From: Georg Bauhaus @ 2008-11-21 18:12 UTC (permalink / raw) ChristopherL schrieb: > On Nov 21, 9:24 am, Anh Vo <anhvofrc...@gmail.com> wrote: >> This code should work for all Ada including Ada 2005. I hope you get >> the idea to print any >> enumerated values. >> >> with Text_Io; >> procedure Print_Enum_Values is >> I_Prefer_Ada : Boolean := True; -- type Boolean is (True, False); >> defined in Standard >> begin >> Text_Io.Put_Line ("Are you prefer Ada? " & Boolean'Image >> (I_Prefer_Ada)); >> end Print_Enum_Values; > > Ok, here is a fill in the blank question. The question is modify the > below code to print out > the contents of variable My_enum. > > procedure test is > type chris_type is (apple, orange, tomatoe, pear, peaches, grapes); > My_enum:chris_type; > begin > > My_enum := grapes; > > end test; You might want to study the code An Voh has provided. It does what you want. Also, and in addition, may I suggest you look at the IO packages for enumerated types in case An Voh's solution is not what you like. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <04e810ee-d4f0-4947-b7c9-78790706d20f@s9g2000prg.googlegroups.com>]
* Re: Help, asking for code to print out an enumerated type [not found] ` <04e810ee-d4f0-4947-b7c9-78790706d20f@s9g2000prg.googlegroups.com> @ 2008-11-21 18:52 ` Georg Bauhaus 0 siblings, 0 replies; 7+ messages in thread From: Georg Bauhaus @ 2008-11-21 18:52 UTC (permalink / raw) ChristopherL schrieb: > So, > what should I say. I would like to know how to print out My_enum in > the above program. It's a basic simple question! Yes, and the answer is also quite simple since Boolean is an enumerated type. The question sounded a bit like, "Please, could you do my homework"? Or similar. Hence, as per tradition, no free beer solution, I'd guess. No offence intended. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, asking for code to print out an enumerated type 2008-11-21 17:24 ` Anh Vo [not found] ` <c72d282b-044a-44ac-be29-de9de4188418@z27g2000prd.googlegroups.com> @ 2008-11-21 21:10 ` Jeffrey R. Carter 2008-11-21 21:19 ` Anh Vo 1 sibling, 1 reply; 7+ messages in thread From: Jeffrey R. Carter @ 2008-11-21 21:10 UTC (permalink / raw) Anh Vo wrote: > > I_Prefer_Ada : Boolean := True; -- type Boolean is (True, False); > defined in Standard No, Boolean is defined as type Boolean is (False, True); ARM 3.5.3. -- Jeff Carter "No one is to stone anyone until I blow this whistle, do you understand? Even--and I want to make this absolutely clear--even if they do say, 'Jehovah.'" Monty Python's Life of Brian 74 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, asking for code to print out an enumerated type 2008-11-21 21:10 ` Jeffrey R. Carter @ 2008-11-21 21:19 ` Anh Vo 2008-11-21 21:26 ` Anh Vo 0 siblings, 1 reply; 7+ messages in thread From: Anh Vo @ 2008-11-21 21:19 UTC (permalink / raw) On Nov 21, 1:10 pm, "Jeffrey R. Carter" <spam.jrcarter....@spam.acm.org> wrote: > Anh Vo wrote: > > > I_Prefer_Ada : Boolean := True; -- type Boolean is (True, False); > > defined in Standard > > No, Boolean is defined as > > type Boolean is (False, True); > > ARM 3.5.3. Oops! you are right. However, for the purpose of printing out the enumerated values, the order does invalidate the code though. A. Vo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, asking for code to print out an enumerated type 2008-11-21 21:19 ` Anh Vo @ 2008-11-21 21:26 ` Anh Vo 0 siblings, 0 replies; 7+ messages in thread From: Anh Vo @ 2008-11-21 21:26 UTC (permalink / raw) On Nov 21, 1:19 pm, Anh Vo <anhvofrc...@gmail.com> wrote: > On Nov 21, 1:10 pm, "Jeffrey R. Carter" > > <spam.jrcarter....@spam.acm.org> wrote: > > Anh Vo wrote: > > > > I_Prefer_Ada : Boolean := True; -- type Boolean is (True, False); > > > defined in Standard > > > No, Boolean is defined as > > > type Boolean is (False, True); > > > ARM 3.5.3. > > Oops! you are right. However, for the purpose of printing out the > enumerated values, the order does invalidate the code though. > > A. Vo Oops again! I meant the order does not invalidate ... ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-11-21 21:26 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <37008a4c-cdbf-42f4-b806-352501419ff6@n33g2000pri.googlegroups.com> 2008-11-21 16:37 ` Help, asking for code to print out an enumerated type Georg Bauhaus 2008-11-21 17:24 ` Anh Vo [not found] ` <c72d282b-044a-44ac-be29-de9de4188418@z27g2000prd.googlegroups.com> 2008-11-21 18:12 ` Georg Bauhaus [not found] ` <04e810ee-d4f0-4947-b7c9-78790706d20f@s9g2000prg.googlegroups.com> 2008-11-21 18:52 ` Georg Bauhaus 2008-11-21 21:10 ` Jeffrey R. Carter 2008-11-21 21:19 ` Anh Vo 2008-11-21 21:26 ` Anh Vo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox