home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT070.ZIP / MENUS.EXE / MULT.MNU < prev    next >
Text File  |  1990-06-30  |  1KB  |  82 lines

  1. Comment
  2. ================================================
  3.  
  4. This example shows the use of arrays.
  5. Type MarxMenu Mult to run.
  6.  
  7. You'll notice that you don't need to declare the
  8. size or dimensions of the array.
  9.  
  10. ================================================
  11. EndComment
  12.  
  13. ClearScreenOnExit Off
  14. StandardIO
  15.  
  16. Var
  17.   TableA
  18.   TableB
  19.  
  20. ShowMemory
  21.  
  22. ;------ Create the multiplication table in the Array.
  23.  
  24. MakeTable (9,9)
  25.  
  26. ;------ You can copy an array in the following manner
  27.  
  28. TableB = TableA
  29.  
  30. Writeln 'Arrays Allocated'
  31.  
  32. ShowMemory
  33.  
  34. Writeln 'Multiplication Table:'
  35. Writeln
  36.  
  37. ;------ Print the table from the Array.
  38.  
  39. PrintTable (9,9,TableB)
  40.  
  41. Dispose TableA
  42. Dispose TableB
  43.  
  44. Writeln
  45. Writeln 'Arrays DeAllocated'
  46.  
  47. ShowMemory
  48.  
  49. ;------ Subroutines
  50.  
  51. Procedure ShowMemory
  52. var X
  53.    X = 1
  54.    Writeln 'Free Memory: ' FreeMemory
  55.    Writeln
  56. EndProc
  57.  
  58.  
  59. Procedure MakeTable (X,Y)
  60. var A
  61.    Loop Y
  62.    A = LoopIndex
  63.       Loop X
  64.          TableA[A,LoopIndex] = A * LoopIndex
  65.       EndLoop
  66.    EndLoop
  67. EndProc
  68.  
  69.  
  70. Procedure PrintTable (X,Y,Table)
  71. var A
  72.    Loop Y
  73.    A = LoopIndex
  74.       Loop X
  75.          if Table[A,LoopIndex] < 10 then Write ' '
  76.          Write ' ' Table[A,LoopIndex]
  77.       EndLoop
  78.       Writeln
  79.    EndLoop
  80. EndProc
  81.  
  82.