Structured Programming in Basic Problems

© 1998 by Dr. Thomas W. MacFarland -- All Rights Reserved


     Instructions:   Review the following program and see if you can 
                     predict the outcome by completing a "pencil 
                     trace" of the code.  

                     Program output is provided at the end of this 
                     page.

     Compiler:       The program was prepared using GWBasic, which  
                     requires the use of line numbers.


10 REM This program demonstrates a two-dimensional array.
20 DIM X$(3,1)
30 FOR R = 0 TO 2
40   READ X$(R,0), X$(R,1)
50   PRINT X$(R,0), X$(R,1)
60 NEXT R
70 RESTORE
99 END
100 DATA ABC, 123
101 DATA DEF, 456
102 DATA GHI, 789
103 DATA JKL, 987
10000 REM And the answer is ...
10010 REM ABC         123
10020 REM DEF         456
10030 REM GHI         789

Please send comments or suggestions to Dr. Thomas W. MacFarland

There have been [an error occurred while processing this directive] visitors to this page since February 1, 1999.