From: "Liddle Feesh" <no_see_reply_address@spam.com>
Subject: Re: Why can't i get an EXE!
Date: Mon, 7 Jan 2002 21:59:00 -0000
Date: 2002-01-07T21:59:00+00:00 [thread overview]
Message-ID: <BSo_7.7961$6q2.1979832@news2-win.server.ntlworld.com> (raw)
In-Reply-To: z4MZ7.61963$4x4.8851706@news2-win.server.ntlworld.com
"NTL" wrote:
> >> BEGIN QUE.ADS
>
> package que is
> empty_queue : EXCEPTION;
>
> type queue is array(1..500) of integer;
Array 1..500? Big time efficiency waste !!!
You have to incorporate this using linked lists.
Okay. In reference to Real Time Programming - you have to justify these
changes to the master spec.
> <<END QUE.ADS
>
> >>BEGIN QUE.ADB
>
> with ada.text_io, ada.integer_text_io;
> use ada.text_io, ada.integer_text_io;
> with text_io;
> use text_io;
^^^ Big inconsistancy
>
> package body que is
>
>
>
> procedure initialiser(q: in out queue; head: in out integer; tail: in out
> integer) is
> begin
> tail := 0;
> head := 1;
> for count in head..tail loop
> q(count) := 0;
> end loop;
>
> end initialiser;
>
> procedure add(q: in out queue; head: in out integer; tail: in out integer)
> is
> begin
> put_line("Please enter an integer ");
> get(n);
> tail := tail+1;
> q(tail) := n;
> --call proc show here
> end add;
>
> procedure remove(q: in out queue; head: in out integer; tail: in out
> integer) is
> begin
> if head < tail then
> --put_line("Queue is currently empty");
> raise EMPTY_QUEUE;
> else
> head := head + 1;
> end if;
> --call proc show here
You have implemented this using an array. The node should contain a pointer
of type link which points to the base value of the next node. Geddit?
> exception
> when EMPTY_QUEUE=>
> SKIP_LINE;
> Put_Line("The queue is currently empty");
> NEW_LINE;
>
> end remove;
>
> procedure show(q: in out queue; head: in out integer; tail: in out
integer)
> is
> begin
> if head < tail then
> --put_line("Queue is currently empty");
> raise EMPTY_QUEUE;
> else
> for count in head..tail loop
> put_line(" ");
> end loop;
> end if;
> exception
> when EMPTY_QUEUE=>
> SKIP_LINE;
> Put_Line("The queue is currently empty");
> NEW_LINE;
>
> end show;
>
>
> begin
> loop
> initialiser(q => qs, head => heads, tail => tails);
> Put_Line("****************************");
> Put_Line(" 1). Add to queue");
> Put_Line(" 2). remove to queue");
> Put_Line(" 3). Quit queue program");
> Put_Line("****************************");
> get(A);
> case A is --Execute menu option depending on A's value
> when 1 => add(q => qs, head => heads, tail => tails);
> when 2 => remove(q => qs, head => heads, tail => tails);
> when 3 => exit;
> when others => Put_Line("Sorry incorrect entry please retry");
> end case;
> end loop;
>
>
> end que;
>
> <<END QUE.ADB
Also - you have to:
Present a Package Spec
Present a Package Body
Present a Test Harness
Okay? So name your package body and spec the same (bar the extension), then
create a main body and include the other files in this body. Put your main
menu in there.
c u,
--
Liddle Feesh
' O 0 o <"//>< ' o'^
(Remove UNDERPANTS to reply)
next prev parent reply other threads:[~2002-01-07 21:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-05 23:33 Why can't i get an EXE! NTL
2002-01-06 0:52 ` Preben Randhol
2002-01-06 2:02 ` Phoenix.
2002-01-06 12:19 ` Preben Randhol
2002-01-07 11:06 ` Preben Randhol
2002-01-07 21:52 ` Liddle Feesh
2002-01-08 13:14 ` Phoenix.
2002-01-08 13:31 ` Phoenix.
2002-01-08 13:55 ` Liddle Feesh
2002-01-08 13:52 ` Liddle Feesh
2002-01-07 21:59 ` Liddle Feesh [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-01-06 19:45 Phoenix.
2002-01-06 20:12 ` Preben Randhol
2002-01-06 22:03 ` Phoenix.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox