comp.lang.ada
 help / color / mirror / Atom feed
From: willmann817 <willmann817@gmail.com>
Subject: Re: Algorithms Homework Help?!?!
Date: Tue, 15 Jan 2013 19:54:46 -0800 (PST)
Date: 2013-01-15T19:54:46-08:00	[thread overview]
Message-ID: <23c44925-1fd0-4b87-8b50-2cd876fbf424@googlegroups.com> (raw)
In-Reply-To: <b230ff1a-1ce7-4510-9576-3b48254db205@googlegroups.com>

On Tuesday, January 15, 2013 7:01:59 PM UTC-5, willmann817 wrote:
> On Tuesday, January 15, 2013 6:54:19 PM UTC-5, Jeffrey Carter wrote:
> 
> > On 01/15/2013 02:52 PM, willmann817 wrote:
> 
> > 
> 
> > >
> 
> > 
> 
> > >     function Candy(Kids : Integer; MsPerColor : Int_Array) return Integer is	
> 
> > 
> 
> > > 	lo : Integer := 1;
> 
> > 
> 
> > > 	hi : Integer := 50000;
> 
> > 
> 
> > > 	mid : Integer;
> 
> > 
> 
> > > 	begin
> 
> > 
> 
> > > 		for I in MsPerColor'Range loop
> 
> > 
> 
> > > 			if  MsPerColor(I) > hi then
> 
> > 
> 
> > > 				hi :=  MsPerColor(I);
> 
> > 
> 
> > > 			end if;
> 
> > 
> 
> > > 			if  MsPerColor(I) < lo then
> 
> > 
> 
> > > 				lo :=  MsPerColor(I);
> 
> > 
> 
> > > 			end if;
> 
> > 
> 
> > > 		end loop;
> 
> > 
> 
> > 
> 
> > 
> 
> > Will you ever have more than 50,000 M&Ms of any one color? If not, then Hi will 
> 
> > 
> 
> > remain 50,000. Will you ever have less than 1 M&M of any one color? If not, then 
> 
> > 
> 
> > Lo will remain 1.
> 
> > 
> 
> > 
> 
> > 
> 
> > -- 
> 
> > 
> 
> > Jeff Carter
> 
> > 
> 
> > "My legs are gray, my ears are gnarled, my eyes are old and bent."
> 
> > 
> 
> > Monty Python's Life of Brian
> 
> > 
> 
> > 81
> 
> Jeff I changed the initial values of lo and hi but there is still something getting me stuck in an infinite loop.
> 
> 	lo : Integer := Integer'Last; 
> 
> 	hi : Integer := Integer'First;

Nevermind everyone I got the answer and figured it out with hints one of my classmates.



  reply	other threads:[~2013-01-16  3:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 21:52 Algorithms Homework Help?!?! willmann817
2013-01-15 22:50 ` Adam Beneschan
2013-01-15 23:50   ` willmann817
2013-01-15 23:43 ` Shark8
2013-01-15 23:54 ` Jeffrey Carter
2013-01-16  0:01   ` willmann817
2013-01-16  3:54     ` willmann817 [this message]
2013-01-16 19:47 ` Robert A Duff
2013-01-16 21:19   ` Adam Beneschan
2013-01-16 22:27     ` Robert A Duff
2013-01-16 23:43       ` Adam Beneschan
2013-02-07  7:06 ` ajim
2013-02-07  7:10 ` ajim
replies disabled

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