From: Adam Beneschan <adam@irvine.com>
Subject: Re: Array Help?
Date: Tue, 28 Feb 2012 16:27:42 -0800 (PST)
Date: 2012-02-28T16:27:42-08:00 [thread overview]
Message-ID: <168f5d8c-8a63-40aa-b0a8-378ab8003416@t16g2000yqt.googlegroups.com> (raw)
In-Reply-To: m2booik5ie.fsf@pushface.org
On Feb 28, 1:33 pm, Simon Wright <si...@pushface.org> wrote:
> Will <willmann...@gmail.com> writes:
> > Hello all,
>
> > I am looking for your help again. I 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) = 62 but what if I wanted to go through an array and
> > identify certain indexes by what they contain? In my particular case
> > I need to identify the indexes that have numbers in them that do not
> > end in 1 or 2. These numbers range from 1 to 4 digits. Any 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!)
>
> for J in A'Range loop
> declare
> Decimal_Units : constant Natural := abs (A (J) mod 10);
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.
> begin
> if Decimal_Units /= 1 and Decimal_Units /= 2 then
> -- A (J) doesn't end in 1 or 2.
> end if;
> end;
> end loop;
-- Adam
next prev parent reply other threads:[~2012-02-29 0:27 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 20:15 Array Help? Will
2012-02-28 20:47 ` Ludovic Brenta
2012-02-28 22:11 ` Simon Wright
2012-02-28 23:09 ` Will
2012-02-29 0:24 ` Adam Beneschan
2012-02-28 20:50 ` Gautier write-only
2012-02-28 21:33 ` Simon Wright
2012-02-29 0:27 ` Adam Beneschan [this message]
2012-02-29 8:00 ` Simon Wright
2012-02-29 8:48 ` Simon Wright
2012-02-29 0:22 ` Adam Beneschan
2012-02-29 16:09 ` Robert A Duff
2012-02-29 16:50 ` Ludovic Brenta
2012-02-29 18:24 ` Robert A Duff
2012-02-29 19:45 ` stefan-lucks
2012-02-29 20:45 ` Jeffrey Carter
2012-02-29 21:27 ` stefan-lucks
2012-02-29 23:06 ` Robert A Duff
2012-03-02 13:45 ` stefan-lucks
2012-03-07 23:58 ` Randy Brukardt
2012-03-08 11:20 ` stefan-lucks
2012-03-09 2:02 ` Randy Brukardt
2012-03-09 8:48 ` stefan-lucks
2012-03-09 21:10 ` Randy Brukardt
2012-03-15 2:55 ` BrianG
2012-03-15 7:46 ` stefan-lucks
2012-02-29 20:07 ` Dmitry A. Kazakov
2012-02-29 23:15 ` Robert A Duff
2012-03-01 8:54 ` Dmitry A. Kazakov
2012-03-01 14:06 ` Robert A Duff
2012-02-29 20:47 ` Simon Wright
2012-02-29 22:23 ` Robert A Duff
2012-02-29 23:27 ` Robert A Duff
2012-03-01 0:53 ` Adam Beneschan
2012-03-01 7:16 ` Ludovic Brenta
2012-03-01 14:03 ` Robert A Duff
2012-03-08 0:11 ` Randy Brukardt
2012-03-08 0:08 ` Randy Brukardt
2012-02-29 23:30 ` Simon Wright
2012-02-29 18:35 ` Jeffrey Carter
2012-02-29 22:59 ` Robert A Duff
2012-02-29 23:51 ` Jeffrey Carter
2012-03-01 3:03 ` Robert A Duff
2012-02-29 20:40 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox