comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: making compare function with multiple values(help for newbie)
Date: Thu, 12 Oct 2006 05:36:33 GMT
Date: 2006-10-12T05:36:33+00:00	[thread overview]
Message-ID: <BvkXg.236090$1i1.131020@attbi_s72> (raw)
In-Reply-To: <1160607835.370325.213610@e3g2000cwe.googlegroups.com>

isaac2004 wrote:
> hello for a assignment in one of my classes, i am asked to add 3 values
> to an array for every appearance of the index (so 3 values like 222, 5,
> 4 are in one index of the array) and then compare a user prompt to see
> if the exact index is in the array, i can do this if there is only one
> value but im haveing trouble getting my head around the comparing of
> three values at once could i just use nested conditionals in a for
> loop. any algorithm ideas would be greatly appreciated. thank you

What are the components of the array? A record:

type Three_Values is record
    First  : Integer;
    Second : Integer;
    Third  : Integer;
end record;

type Three_At_Each is array (Positive range <>) of Three_Values;

An array:

type Three_Values is array (Positive range 1 .. 3) of Integer;

type Three_At_Each is array (Positive range <>) of Three_Values;

Or are you using a 2D array:

type Two_D is array (Positive range <>, Positive range <>) of Integer;

type Three_At_Each (Num_Rows : Positive) is record
    Value : Two_D (1 .. Num_Rows, 1 .. 3);
end record;

Or something else I haven't thought of?

-- 
Jeff Carter
"I blow my nose on you."
Monty Python & the Holy Grail
03



  reply	other threads:[~2006-10-12  5:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11 23:03 making compare function with multiple values(help for newbie) isaac2004
2006-10-12  5:36 ` Jeffrey R. Carter [this message]
2006-10-12  6:08   ` isaac2004
2006-10-12  7:24     ` Ludovic Brenta
2006-10-12 16:21       ` isaac2004
2006-10-12 18:40         ` Jeffrey R. Carter
2006-10-12 18:35     ` Stephen Leake
replies disabled

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