comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex" <alex@foo.invalid>
Subject: Re: Need Help On Ada95 Problem
Date: Fri, 10 Feb 2012 13:50:50 +0000 (UTC)
Date: 2012-02-10T13:50:50+00:00	[thread overview]
Message-ID: <jh37bq$sgv$1@dont-email.me> (raw)
In-Reply-To: wccsjii7r6o.fsf@shell01.TheWorld.com

This is a homework assignment and I think the translation lookup table
is provided as a string, not an array. As far as I know, there is no
way in Ada to make string indexing start at 0.

You're right, an array of chars indexed starting at 0 would be better,
but at this point of the course, I don't think they've covered arrays.
I think they use strings to introduce the concepts and then go into
arrays later.

Robert A Duff wrote:

> "Alex" <alex@foo.invalid> writes:
> 
> > Oh, I see how you're confused. Once you get the value of each digit
> > in the PIN, though, it doesn't matter that the 3-4-5 corresponding
> > to V-A-L  isn't in ASCII order. . . it's still just a direct
> > index-based lookup (just off-by-one because Ada Strings are indexed
> > starting at 1 rather than 0).
> 
> There's no off-by-one issue here.  The OP wants a mapping from
> digit characters to other characters.  That can be implemented
> as a simple array, with the right index subtype.  That array
> isn't a String, because they keys are not integers.
> 
> - Bob



  reply	other threads:[~2012-02-10 13:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  1:03 Need Help On Ada95 Problem Will
2012-02-09  1:51 ` Robert A Duff
2012-02-09  2:01 ` Shark8
2012-02-10  1:36   ` BrianG
2012-02-10  2:22     ` Shark8
2012-02-10  5:32       ` Alex
2012-02-10 15:19         ` Shark8
2012-02-10 15:45           ` Alex
2012-02-10 20:07           ` Robert A Duff
2012-02-12 19:40             ` Will
2012-02-12 19:42               ` Will
2012-02-12 22:26               ` Robert A Duff
2012-02-13  0:41                 ` Will
2012-02-13  0:43                 ` Nasser M. Abbasi
2012-02-10  5:45       ` Alex
2012-02-10 13:29         ` Robert A Duff
2012-02-10 13:50           ` Alex [this message]
2012-02-10 14:30             ` Robert A Duff
2012-02-10 15:32               ` Alex
2012-02-10 20:03                 ` Robert A Duff
2012-02-13  3:28       ` BrianG
2012-02-10  8:47   ` Simon Wright
2012-02-09  3:38 ` Alex
     [not found]   ` <90a10801-440b-4a31-88d0-f0f7c17137f1@eb6g2000vbb.googlegroups.com>
2012-02-09 13:35     ` Alex
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox