comp.lang.ada
 help / color / mirror / Atom feed
From: "Wannabe h4x0r" <chris@dont.spam.me>
Subject: Re: Pool Specific Access Types?
Date: Thu, 06 Sep 2001 20:56:50 GMT
Date: 2001-09-06T20:56:50+00:00	[thread overview]
Message-ID: <mqRl7.85388$K6.35118504@news2> (raw)
In-Reply-To: 3B97ACBA.26FB053F@worldnet.att.net

In article <3B97ACBA.26FB053F@worldnet.att.net>, James Rogers
<jimmaureenrogers@worldnet.att.net> wrote:

> "Mr.Clueless" wrote:
>> 
>> Your right, it is a typo.  Should read...
>> 
>> function Sum(List: Numb_ptr) return Integer is
>>         Local : Numb_ptr := List;  S : Inter := 0;
>                                          ^^^^^
>               Another transcription error
>> begin
>>         while Local /= null loop
>>                 S := S + Local.The_Numb; Local := Local.Next;
>>         end loop; return S;
>> end Sum;
>> 
>> Also, I'm not sure how accessing two fields in a loop would cause an
>> error. I can possibly see issues with regards to scope, but it's a
>> little fuzzy. Perhaps a nested loop, one accessing the "The_Numb" value
>> and the other accessing the "Next" value would do it?
> 
> There is nothing wrong with your logic. I must assume there is something
> wrong with your syntax. 
> 
> Perhaps, if you posted some of the actual code, instead of your manual
> transcriptions, we might be able to find your error.
> 
> Jim Rogers Colorado Springs, Colorado USA

Your right. Sorry. I was afraid that readers of this group really didnt like the posting of 
whole programs, as they can get rather lengthy. But here it is anyways.

-- This is a file so I can learn how to do pointers in Ada95 --
-- Try not to laugh too much. I'm a former C junkie, and it shows. --

with Ada.Text_IO; use Ada.Text_IO;

procedure Point_pract is

	type Numb_holder;
	type Numb_ptr is access Numb_holder;

	type Numb_holder is
		record
		  Number: Integer;
		  Next:   Numb_Ptr;
		end record;

	N: Numb_ptr;

	s : string(1..15);
	len : natural;
	quit : constant String := "q";

	anthr_numb : integer := 0;

begin

	loop
		Put_Line("Enter a number here: ");
		Get_Line( s , len);
		if s /= quit then
			while N /= null loop
					
			   Put_Line( N.Number'img );
			   N := N.Next;	   
			  exit;						
			end loop;
		else										
	            anthr_numb := Integer'value(s(1..len));
                    N := new Numb_holder'(anthr_numb, N);

		New_Line;

		
	       end if;
	end loop;

end Point_pract;



  reply	other threads:[~2001-09-06 20:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-06 14:12 Pool Specific Access Types? Mr.Clueless
2001-09-06 15:07 ` Ted Dennison
2001-09-06 15:36   ` Mr.Clueless
2001-09-06 15:35 ` James Rogers
2001-09-06 15:54   ` Mr.Clueless
2001-09-06 17:04     ` James Rogers
2001-09-06 20:56       ` Wannabe h4x0r [this message]
2001-09-06 21:47         ` Ted Dennison
2001-09-06 22:50         ` Jeffrey Carter
2001-09-06 21:06       ` Pool Specific Access Types? Screw up in the previous post Clueless
2001-09-06 17:06     ` Pool Specific Access Types? Stephen Leake
2001-09-06 22:24   ` Pool Specific Access Types? Thanks Ted...everyone Clueless
2001-09-06 16:55 ` Pool Specific Access Types? Darren New
2001-09-06 17:03   ` Ted Dennison
2001-09-06 17:19     ` Warren W. Gay VE3WWG
2001-09-06 18:55     ` Darren New
replies disabled

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