comp.lang.ada
 help / color / mirror / Atom feed
From: "bklungle" <bklungle@ix.netcom.com>
Subject: Re: Please help link list!
Date: 1997/12/05
Date: 1997-12-05T04:18:08-06:00	[thread overview]
Message-ID: <668kd0$mmc@dfw-ixnews3.ix.netcom.com> (raw)
In-Reply-To: 01bd0074$856c1020$8d484893@default


This is a multi-part message in MIME format.

------=_NextPart_000_0026_01BD0124.8F17E440
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I  am afraid I have to agree with Jerry Van Dijk. I had your code =
rewritten and working and ready to send it to you, along with the pseudo =
code (structured english statements) for it. I read Jerry's comment and =
decided it wasn't fair to do your work for you. As a hint, you started =
out ok, then seem to have forgotten what a link list is, or you are =
trying to design on the terminal using code. Unless you are an expert in =
a language, you shouldn't do this. Draw a detailed flowchart, or do a =
Nassi-Schneiderman, or write a pseudo-code detailed description of the =
steps, or do it in spanish, or, ...; remember, your instructor is your =
best friend in this endeaver. Incidentally, every book I have ever seen =
on Ada, Pascal, C, etc has code in it to do almost exactly what you are =
doing.=20

cheers...bob
Eric Sabo wrote in message <01bd0074$856c1020$8d484893@default>...
    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;=20
    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;=20
    end testing;
    =20
    Thanks,
    Eric Sabo
    sabo@hhs.net

------=_NextPart_000_0026_01BD0124.8F17E440
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><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 =
HTML//EN">
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I&nbsp; am afraid I have to agree =
with Jerry Van=20
Dijk. I had your code rewritten and working and ready to send it to you, =
along=20
with the pseudo code (structured english statements) for it. I read =
Jerry's=20
comment and decided it wasn't fair to do your work for you. As a hint, =
you=20
started out ok, then seem to have forgotten what a link list is, or you =
are=20
trying to design on the terminal using code. Unless you are an expert in =
a=20
language, you shouldn't do this. Draw a detailed flowchart, or do a=20
Nassi-Schneiderman, or write a pseudo-code detailed description of the =
steps, or=20
do it in spanish, or, ...; remember, your instructor is your best friend =
in this=20
endeaver. Incidentally, every book I have ever seen on Ada, Pascal, C, =
etc has=20
code in it to do almost exactly what you are doing. </FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>cheers...bob</FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: =
5px">
    <DIV>Eric Sabo<SABO@HHS.NET> wrote in message=20
    &lt;01bd0074$856c1020$8d484893@default&gt;...</DIV>
    <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=20
    access 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;=20
    end 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=20
    new =
link_integer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    last.next :=3D =
p;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    first.number :=3D =
temp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    last :=3D p;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    put_line(&quot;Please enter a number:=20
    &quot;);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    get(temp);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
first.number=20
    :=3D 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;=20
    <BR>-- 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;=20
    temp :=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></BLOCKQUOTE></=
BODY></HTML>

------=_NextPart_000_0026_01BD0124.8F17E440--





      parent reply	other threads:[~1997-12-05  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-04  0:00 Please help link list! Eric Sabo
1997-12-05  0:00 ` Jerry van Dijk
1997-12-05  0:00 ` bklungle [this message]
replies disabled

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