Re: Fortran Users! Is there a better way to do this?

Gerhard Postpischil <[email protected]>
Newsgroups gmane.comp.emulators.turnkey-mvs
Message-ID <[email protected]>
On 5/15/2010 4:20 PM, Ron Hudson wrote:
> What I am doing now:
>
> an array(5)
> a pointer = 0
> loop
>     increment pointer
>     fill array(pointer) with next calculated result)
>     if pointer = 5
>         print array on a line of the page
>         zero pointer
> until done calculating
> if (pointer .ge. 1) print array(1 - pointer)
> ...
>
> Is there a better way?

About the only thing that would be (slightly) more efficient 
would be to use a single array large enough for all values, then 
use a single WRITE at the end. That supposes you have enough 
storage available to keep all values. If not, use an 
intermediate array size that's a multiple of 5.

Gerhard Postpischil
Bradford, VT
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.