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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2ac407a2a34565a9 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.135.231 with SMTP id pv7mr17178094pbb.8.1330475263232; Tue, 28 Feb 2012 16:27:43 -0800 (PST) Path: h9ni20849pbe.0!nntp.google.com!news1.google.com!postnews.google.com!t16g2000yqt.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Array Help? Date: Tue, 28 Feb 2012 16:27:42 -0800 (PST) Organization: http://groups.google.com Message-ID: <168f5d8c-8a63-40aa-b0a8-378ab8003416@t16g2000yqt.googlegroups.com> References: <10615783-d4a9-4cbd-8971-53ba1100d6a0@b18g2000vbz.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1330475263 10193 127.0.0.1 (29 Feb 2012 00:27:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 29 Feb 2012 00:27:43 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t16g2000yqt.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-02-28T16:27:42-08:00 List-Id: On Feb 28, 1:33=A0pm, Simon Wright wrote: > Will writes: > > Hello all, > > > I am looking for your help again. =A0I know how to refer to a certain > > index in an array. for example if some array A is (53,83,3,62,3,13) > > then A(4) =3D 62 =A0 but what if I wanted to go through an array and > > identify certain indexes by what they contain? =A0In my particular case > > I need to identify the indexes that have numbers in them that do not > > end in 1 or 2. =A0 These numbers range from 1 to 4 digits. =A0Any ideas= on > > how I can do this? > > I presume A is an array of Integer, and that you're interested in the > decimal representation (remember, modern computers run in binary so > in a very real sense numbers have to "end in" 0 or 1!) > > =A0 =A0for J in A'Range loop > =A0 =A0 =A0 declare > =A0 =A0 =A0 =A0 =A0Decimal_Units : constant Natural :=3D abs (A (J) mod 1= 0); If this is a school assignment, then F for you. :) OK, B-, since you almost got it right, so I'll give you part credit. > =A0 =A0 =A0 begin > =A0 =A0 =A0 =A0 =A0if Decimal_Units /=3D 1 and Decimal_Units /=3D 2 then > =A0 =A0 =A0 =A0 =A0 =A0 -- =A0A (J) doesn't end in 1 or 2. > =A0 =A0 =A0 =A0 =A0end if; > =A0 =A0 =A0 end; > =A0 =A0end loop; -- Adam