comp.lang.ada
 help / color / mirror / Atom feed
* Please help link list!
@ 1997-12-04  0:00 Eric Sabo
  1997-12-05  0:00 ` bklungle
  1997-12-05  0:00 ` Jerry van Dijk
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sabo @ 1997-12-04  0:00 UTC (permalink / raw)



This is a multi-part message in MIME format.

------=_NextPart_000_1BB5_01BD004A.9C960820
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

What am I doing wrong with this program?
with gnat.io; use gnat.io;
procedure testing is
type link_integer;
type pointer is access link_integer;
type link_integer is
   record
      number : integer;
      next : pointer;
   end record;
first, last, p : pointer;
temp : integer;
begin
    =20
     put("Project Number two");
     p :=3D new link_integer;
     first :=3D p;
     last :=3D p;
-- Entering the link list
     put_line("Please enter a number: ");
     get(temp);
     while temp /=3D -99 loop
         p.number :=3D temp;
         p :=3D new link_integer;
         last.next :=3D p;
         first.number :=3D temp;
         last :=3D p;
         put_line("Please enter a number: ");
         get(temp);
         first.number :=3D temp;
         first.next :=3D p;
     end loop;     =20
-- printing outing the link list
   temp :=3D first.number;
   while temp /=3D last.number loop
      put("The number is ");
      put(temp);     =20
      temp :=3D p.number;
   end loop;
end testing;

Thanks,
Eric Sabo
sabo@hhs.net

------=_NextPart_000_1BB5_01BD004A.9C960820
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>What am I doing wrong with this=20
program?</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>with gnat.io; =
use=20
gnat.io;<BR>procedure testing is<BR>type link_integer;<BR>type pointer =
is access=20
link_integer;<BR>type link_integer is<BR>&nbsp;&nbsp;=20
record<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number :=20
integer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; next : =
pointer;<BR>&nbsp;&nbsp; end=20
record;</FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>first, last, p : pointer;<BR>temp :=20
integer;<BR>begin<BR>&nbsp;&nbsp;&nbsp;&nbsp; =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
put(&quot;Project Number two&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp; p :=3D =
new=20
link_integer;<BR>&nbsp;&nbsp;&nbsp;&nbsp; first :=3D=20
p;<BR>&nbsp;&nbsp;&nbsp;&nbsp; last :=3D p;<BR>-- Entering the link=20
list<BR>&nbsp;&nbsp;&nbsp;&nbsp; put_line(&quot;Please enter a number:=20
&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp; =
get(temp);<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
while temp /=3D -99 =
loop<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
p.number :=3D temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
p :=3D new=20
link_integer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
last.next :=3D=20
p;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; first.number :=3D =

temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last :=3D=20
p;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
put_line(&quot;Please=20
enter a number: =
&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
get(temp);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
first.number :=3D=20
temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; first.next =
:=3D=20
p;<BR>&nbsp;&nbsp;&nbsp;&nbsp; end loop;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<BR>--=20
printing outing the link list<BR>&nbsp;&nbsp; temp :=3D=20
first.number;<BR>&nbsp;&nbsp; while temp /=3D last.number=20
loop<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; put(&quot;The number is=20
&quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
put(temp);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp=20
:=3D p.number;<BR>&nbsp;&nbsp; end loop;</FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>end testing;</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>Thanks,<BR>Eric Sabo<BR><A=20
href=3D"mailto:sabo@hhs.net">sabo@hhs.net</A></FONT></DIV></BODY></HTML>

------=_NextPart_000_1BB5_01BD004A.9C960820--




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-12-05  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-04  0:00 Please help link list! Eric Sabo
1997-12-05  0:00 ` bklungle
1997-12-05  0:00 ` Jerry van Dijk

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