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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8d87eba0b8755b48 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!c28g2000cwb.googlegroups.com!not-for-mail From: "isaac2004" Newsgroups: comp.lang.ada Subject: Re: making compare function with multiple values(help for newbie) Date: 11 Oct 2006 23:08:45 -0700 Organization: http://groups.google.com Message-ID: <1160633325.255903.114880@c28g2000cwb.googlegroups.com> References: <1160607835.370325.213610@e3g2000cwe.googlegroups.com> NNTP-Posting-Host: 71.231.37.231 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1160633330 30694 127.0.0.1 (12 Oct 2006 06:08:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 12 Oct 2006 06:08:50 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: c28g2000cwb.googlegroups.com; posting-host=71.231.37.231; posting-account=bWy1LAwAAAAtVkasDCH0ykMCBMNd-FcL Xref: g2news2.google.com comp.lang.ada:6928 Date: 2006-10-11T23:08:45-07:00 List-Id: Jeffrey R. Carter wrote: > 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 this is the part that has the generic array FUNCTION InArray IS NEW In_Array_Generic ( ValueType => CatType, IndexType => Integer, ArrayType => CatArrayType); that is the call to the function so it is the first choice i first get the 3 values with a loop FOR I IN 1..5 LOOP Get (Cats(I)); END LOOP; where get is a function that Get(Cat.Id) Get(Cat.Age) Get(Cat.Lives) and the 3 values are stored into one index of the array i hope this helps and thanks