From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7ba49aac4e73460 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.73.229 with SMTP id o5mr2639682pbv.7.1328837820968; Thu, 09 Feb 2012 17:37:00 -0800 (PST) X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.131.2 Path: wr5ni6900pbc.0!nntp.google.com!news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!nntpfeed.proxad.net!88.191.131.2.MISMATCH!news.chainon-marquant.org!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: BrianG Newsgroups: comp.lang.ada Subject: Re: Need Help On Ada95 Problem Date: Thu, 09 Feb 2012 20:36:58 -0500 Organization: A noiseless patient Spider Message-ID: References: <553ceec3-ec34-41de-9723-0dc342379cfe@vv9g2000pbc.googlegroups.com> Mime-Version: 1.0 Injection-Date: Fri, 10 Feb 2012 01:37:00 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="TFSzwg9zEWICKE4g7mPu9w"; logging-data="30553"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Iy1HoYE6hGdkT4yNEH0Kz" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111108 Thunderbird/3.1.16 In-Reply-To: <553ceec3-ec34-41de-9723-0dc342379cfe@vv9g2000pbc.googlegroups.com> Cancel-Lock: sha1:K1o6MdEU+IM826B1l2gE4N9NcOQ= Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-02-09T20:36:58-05:00 List-Id: On 02/08/2012 09:01 PM, Shark8 wrote: > On Feb 8, 7:03 pm, Will wrote: >> I am new to Ada and need help on an exercise for school. Can anyone >> help. The problem is as follows ( you can skip all the build up >> background A Christmas Story references): >> >> Problem 1: Secret Decoder Ring ... >> number wheel -> 0 1 2 3 4 5 6 7 8 9 >> letter wheel -> U R O V A L T I N E >> >> So, for example, Randy encrypts the PIN 9537 as ELVI. >> >> Complete the function Encrypt(PIN) that takes a 4-digit PIN (as a >> string) and returns the corresponding 4-letter code (also as a >> string). >> >> Note: It would be possible to convert digits to letters using a giant >> IF statement, but don't do this. Instead, the letter wheel is given to >> you as a string, so use each digit to read the appropriate letter from >> the string. > > Alright this is actually a simple problem; there are several ways to > go about this, > but let's play to Ada's strengths and use types. > ... > Reading the problem the note says: > It would be possible to convert digits to letters using a giant > IF statement, but don't do this. Instead, the letter wheel is given to > you as a string, so use each digit to read the appropriate letter from > the string. > > Meaning that they're hinting strongly that you use the CASE statement. I don't see why this would require either an if or a case. -- --- BrianG 000 @[Google's email domain] .com