Help need GWBASIC interpretation 
Author Message
 Help need GWBASIC interpretation

Can someone please explain what these few lines of code do?  Any help
is greatly appreciated.

The program is run using data from an old Lotus spreadsheet I believe.

I, J, TOTM are integers

1  DIMENSION SA(2,20), SF(2,20)
10 WRITE(6,110) (SA(1,J),J=1,16)
20 READ (5,115) (SF(1,J),J=1,16)
30 WRITE(6,203) (T(I,J),J=1,16),TOTM,I



Tue, 15 Mar 2005 23:34:08 GMT  
 Help need GWBASIC interpretation

Quote:
> Can someone please explain what these few lines of code do?  Any help
> is greatly appreciated.

> The program is run using data from an old Lotus spreadsheet I believe.

> I, J, TOTM are integers

> 1  DIMENSION SA(2,20), SF(2,20)
> 10 WRITE(6,110) (SA(1,J),J=1,16)
> 20 READ (5,115) (SF(1,J),J=1,16)
> 30 WRITE(6,203) (T(I,J),J=1,16),TOTM,I

Although the code might be BASIC, it's not any BASIC that Microsoft ever
wrote.

MS as DIM, not DIMENSION, and while it does have a READ statement, it's not
used in that manner (no parameters except a string of variables to assign
read data), and there is a WRITE statement, but again, it's not used in that
fashion, it's used to write to a sequential file.

--
Fris "HTH" bee? MCNGP #13

http://www.mcngp.tk
The MCNGP Team - We're here to help



Wed, 16 Mar 2005 00:01:11 GMT  
 Help need GWBASIC interpretation
This is fortran not BASIC, however it is short, so I'll try to
interpret:

line 1 reserves space for two arrays of real numbers 2 columns and 20
rows each
line 20 writes on unit 6 (usually the standard output device, a console
-- or if your code is old enough, a printer) rows 1 through 16 of column
1 of the array sa using a format specified by the line numbered 110.
line 20 reads from unit 5 (usually the standard input device, either a
console or a card reader) the first 16 rows of the first column of array
sf using the format specified on line 115
line 30 writes to unit 6 the first 16 rows of column i of the undefined
array t (or perhaps 16 values of the function t, if there really is no
dimension/common statement for t) followed by the values of the
variables totm and i using the format specified by line 203

BTW Since my memory is fading after 30 years of nonuse of FORTRAN, I may
have the words 'columns' and 'rows' reversed; it does not matter in the
explanation of these particular statements.

Quote:

> Can someone please explain what these few lines of code do?  Any help
> is greatly appreciated.

> The program is run using data from an old Lotus spreadsheet I believe.

> I, J, TOTM are integers

> 1  DIMENSION SA(2,20), SF(2,20)
> 10 WRITE(6,110) (SA(1,J),J=1,16)
> 20 READ (5,115) (SF(1,J),J=1,16)
> 30 WRITE(6,203) (T(I,J),J=1,16),TOTM,I



Tue, 15 Mar 2005 23:54:26 GMT  
 Help need GWBASIC interpretation

Quote:

> Can someone please explain what these few lines of code do?  Any help
> is greatly appreciated.

> The program is run using data from an old Lotus spreadsheet I believe.

> I, J, TOTM are integers

> 1  DIMENSION SA(2,20), SF(2,20)
> 10 WRITE(6,110) (SA(1,J),J=1,16)
> 20 READ (5,115) (SF(1,J),J=1,16)
> 30 WRITE(6,203) (T(I,J),J=1,16),TOTM,I

That's FORTRAN, not BASIC.....

So what does it mean?

      DIMENSION SA(2,20), SF(2,20)

Allocates real arrays SA and SF (both 2 by 20).  Variables are
implicitly typed in FORTRAN such that names beginning with
I,J,K,L,M,N are by default integers, and names beginning with some
other letter are by default reals.  These defaults can be overridden
by either explicit type statements, or by an IMPLICIT <type>(<range>)
statement.

      WRITE(6,110) (SA(1,J),J=1,16)

6 is the "standard output device" in FORTRAN.  This outputs the
values of SA(1,1),SA(1,2),SA(1,3),SA(1,4),.....,S(1,16) using the
format specification no 110 (which is absent from these lines), but
a plausible FORMAT statement could be:

 110  FORMAT(F8.1)

which specifies output of a floating-point number in fixed-point
form: 8 columns and 1 decimal.  The format is reused as needed.

      READ (5,115) (SF(1,J),J=1,16)

5 is the "standard input" device in FORTRAN.  This reads 16 floating-
point values into SF(1,1),SF(1,2),....,SF(1,16) using the (absent)
format statement 115

      WRITE(6,203) (T(I,J),J=1,16),TOTM,I

Writes T(I,1),T(I,2),....,T(I,16),TOTM,I using format statement 203

In FORTRAN, (numeric) labels can be used for three purposes:

1. Targets for GOTO statements
2. Specification of where a loop statement ends
3. FORMAT statements used by READ and WRITE statements

--
----------------------------------------------------------------
Paul Schlyter,  Swedish Amateur Astronomer's Society (SAAF)
Grev Turegatan 40,  S-114 38 Stockholm,  SWEDEN
e-mail:  pausch at saaf dot se
WWW:     http://hem.passagen.se/pausch/index.html
         http://home.tiscali.se/~pausch/



Wed, 16 Mar 2005 00:42:24 GMT  
 Help need GWBASIC interpretation

Quote:



>> Can someone please explain what these few lines of code do?  Any help
>> is greatly appreciated.

>> The program is run using data from an old Lotus spreadsheet I believe.

>> I, J, TOTM are integers

>> 1  DIMENSION SA(2,20), SF(2,20)
>> 10 WRITE(6,110) (SA(1,J),J=1,16)
>> 20 READ (5,115) (SF(1,J),J=1,16)
>> 30 WRITE(6,203) (T(I,J),J=1,16),TOTM,I

>Although the code might be BASIC, it's not any BASIC that Microsoft ever
>wrote.

>MS as DIM, not DIMENSION, and while it does have a READ statement, it's not
>used in that manner (no parameters except a string of variables to assign
>read data), and there is a WRITE statement, but again, it's not used in that
>fashion, it's used to write to a sequential file.

FORTRAN has a PRINT statement too.  Instead of

      WRITE(6,203) <variable list>

you can write

      PRINT 203, <variable list>

PRINT only works on the default output device.  If you want
to write to some other file or device (e.g. by explicitly
OPEN'ing a new unit number), you must WRITE to that unit.

--
----------------------------------------------------------------
Paul Schlyter,  Swedish Amateur Astronomer's Society (SAAF)
Grev Turegatan 40,  S-114 38 Stockholm,  SWEDEN
e-mail:  pausch at saaf dot se
WWW:     http://hem.passagen.se/pausch/index.html
         http://home.tiscali.se/~pausch/



Wed, 16 Mar 2005 00:44:47 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. need help randomizing on GWBASIC

2. HELP : I REALLY NEED GWBASIC.COM

3. need help for gwbasic

4. Help Needed -- GWBASIC unprotect?

5. Need help compiling gwbasic/qbasic code

6. Doorst: need help with GWBASIC/QBASIC

7. GWBASIC - HELP NEEDED - FOLLOW-UP

8. GWBASIC PROBLEM - HELP NEEDED

9. GWBASIC (1/1) - gwbasic.zip [2/2]

10. GWBASIC (1/1) - gwbasic.zip [1/2]

11. HELP!: CR6 Date Interpretation Problem

12. GWBASIC HELP HELP

 

 
Powered by phpBB® Forum Software