[posted and mailed as requested]
Quote
"Arron Mitchell" <ar...@nemaine.com> wrote:
>Hello ok I guesse I should be more clear on what I ment.. here is the pas
>file that I made I know it works so if you decide to use it it will work
>for you..
Indent your code a little. It'll make it easier to read.
If you put "PROCEDURE Main; FORWARD;" at the top of your program
(e.g. before Procedure A), then main will be forward declared
and visible to all following procedures.
However, I don't think this is what you want. Take a pencil and
trace the flow of your program. Tracing the program flow in a
program design outline is called bench testing. A little design
and bench testing can save lots of heart ache.
Okay, let's trace. The program body calls Main. Main asks for
a number, then calls A, B, or C. You now want the last
instruction in A, B, or C to call Main. So again Main prompts
for a number an calls A, B, or C. As you want it, the last
instruction would again call Main. And so goes the round until
eventually you run out of stack space and the program abends!
When a procedure or function ends, it returns to the caller and
program execution resumes with the caller's next instruction.
It doesn't matter which function or procedure Main calls, nor
which procedure they call. Simply let each one end to have
execution resume with the caller's next statement.
BTW, you should have Main test the input to insure that it is
within the proper range. Of course if you develop with range
checking on {$R+} then out of range values will be caught and
terminate the program gracefully. Care to speculate what will
happen if the error is not caught?
From the nature of your problem I can see you are just starting.
Don't get discouraged, Arron. Things do get easier as you
learn.
...red
--
Support the anti-Spam amendment
Join at http://www.cauce.org/