The program:

! MExample Program 8-8

! Fill an array from a text file and

! print the array in a formatted display.

! create the data file numbers.dat with numbers 1-15

! Fill an array from a text file.

DIM Table(1 to 3, 1 to 5)

SET ZONEWIDTH 5

!INPUT prompt "File name? ": FileName$

LET Filename$ = "numbers.dat"

OPEN #1: name FileName$

FOR Row = 1 to 3

FOR Column = 1 to 5

INPUT #1: Table(Row, Column)

NEXT Column

NEXT Row

 

! Display the filled array.

PRINT

FOR Row = 1 to 3

FOR Column = 1 to 5

SET COLOR "red"

PRINT Table(Row, Column),

NEXT Column

PRINT

NEXT Row

SOUND 200,.2

SET COLOR "blue"

PRINT "The data file is numbers.dat"

END

The output:

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

The data file is numbers.dat