Loop problem
Author Message
Loop problem

--

Wed, 18 Jun 1902 08:00:00 GMT
Loop problem

On Sun, 14 Jun 1998 10:00:15 -0400, James Morrish

Quote:

>--

A concise yet thorough outline of your problem.

----------------------------
"Eagles may soar, but weasels aren't sucked into jet engines."

http://www.flatworld.u-net.com/home.htm - newly redesigned

Wed, 18 Jun 1902 08:00:00 GMT
Loop problem

The following piece is a loop problem that I am having. The
program accepts a number and converts it. When another conversion
is required the program issues a error. Can anyone help me.
================================================================
{main program}
var
octal:string;
count:longint;
hex1:array[1..4]of integer;
remain1,remain2,remain3,wordlen,num:integer;
total_decimal: longint;
begin {of main program}
begin
Enter_Octal (Octal);
Octal_to_Decimal (Octal,total_decimal);
end;
end.

--

Wed, 18 Jun 1902 08:00:00 GMT
Loop problem

Quote:
> On Sun, 14 Jun 1998 10:00:15 -0400, James Morrish

> >--

> A concise yet thorough outline of your problem.

> ----------------------------
> "Eagles may soar, but weasels aren't sucked into jet engines."

> http://www.flatworld.u-net.com/home.htm - newly redesigned

And the sardines will always come to the trawler

Wed, 18 Jun 1902 08:00:00 GMT
Loop problem

Quote:
> The following piece is a loop problem that I am having. The
> program accepts a number and converts it. When another conversion
> is required the program issues a error. Can anyone help me.
> ================================================================
>>    begin {of main program}
>          while reply = 'y' do
>           begin
>          Enter_Octal (Octal);
>          Octal_to_Decimal (Octal,total_decimal);
>          end;
> end.

> --
>   where is the value reply generated from at the end of your program ????

as it reads your program should loop forever as there is no condition
set at the end to read the reply unless of course you have forgot to
include this or is it in another procedure????. The easiest solution to
this is to read in the reply before you end the loop i.e. write('Do it
again (y/n) : ');
end loop

Wed, 18 Jun 1902 08:00:00 GMT
Loop problem

Quote:
> The following piece is a loop problem that I am having. The
> program accepts a number and converts it. When another conversion
> is required the program issues a error. Can anyone help me.

Well, what are we supposed to do with _this_?  For all I see, it's
just some pseudo-code showing the logic flow of a program (did you write
it yourself, or is it only the skeleton your instructor gave you?), and
you (once again) provide us with no actual information: what error? where
does it occur? what data values did you use?
I can see some things I personally don't like (e.g. the procedure
parameters for each subprogram don't seem to be in a consistent "input,
output" order, but that's possibly only a style matter.  The real problem
is that no one can see what's actually going on in the program (the real
functional code is missing), and you haven't told us _anything_ about the
"error"...
You'll never get any help (here or elsewhere) if you don't "come
clean" with your requirements, code, and full problem description.  You
know, there's that old saying about "God helps those who help
themselves." - it also applies here...
Quote:
> ================================================================
> {main program}
>   var
>    octal:string;
>    count:longint;
>    hex1:array[1..4]of integer;
>    remain1,remain2,remain3,wordlen,num:integer;
>    total_decimal: longint;
>    begin {of main program}
>          while reply = 'y' do
>           begin
>          Enter_Octal (Octal);
>          Octal_to_Decimal (Octal,total_decimal);