Two-dimensional array
#4
The extension: Determining a two-dimensional field and resize it.

Code: (Select All)
$Console:Only
Option _Explicit

Option Base 1

Dim As Integer neuDimensionZeile, neuDimensionSpalte
Dim As Integer zeilenDim, spaltenDim
Dim As Integer a, b, i, j, y, z

Locate 2, 2
Input "Feldimension Zeilen  : ", zeilenDim
Locate 3, 2
Input "Felddimension Spalten: ", spaltenDim
Dim As Integer zweiDimfeld(zeilenDim, spaltenDim)

Locate CsrLin + 2, 2
z = 1
For i = 1 To zeilenDim
  For j = 1 To spaltenDim
    zweiDimfeld(i, j) = z
    Print Using "## "; zweiDimfeld(i, j),
    z = z + 1
  Next
  Print: Locate , 2
Next

Locate CsrLin + 2, 2
Input "Neue Feldimension Zeile : ", neuDimensionZeile
Locate CsrLin + 0, 2
Input "Neue Feldimension Spalte: ", neuDimensionSpalte

ReDim zweiDimfeld(neuDimensionZeile, neuDimensionSpalte)

Locate CsrLin + 2, 2
y = 1
For a = 1 To neuDimensionZeile
  For b = 1 To neuDimensionSpalte
    zweiDimfeld(a, b) = y
    Print Using "## "; zweiDimfeld(a, b),
    y = y + 1
  Next
  Print: Locate , 2
Next

Locate CsrLin + 3, 2

End

[Image: Zweidim-Feld-Neu-Dim.jpg]
Reply


Messages In This Thread
Two-dimensional array - by Kernelpanic - 12-28-2022, 09:55 PM
RE: Two-dimensional array - by madscijr - 12-28-2022, 11:54 PM
RE: Two-dimensional array - by Kernelpanic - 12-29-2022, 12:40 AM
RE: Two-dimensional array - by Kernelpanic - 12-29-2022, 10:10 PM
RE: Two-dimensional array - by mdijkens - 12-30-2022, 01:04 PM
RE: Two-dimensional array - by bobalooie - 01-05-2023, 02:26 AM
RE: Two-dimensional array - by madscijr - 01-05-2023, 03:00 AM
RE: Two-dimensional array - by mnrvovrfc - 01-05-2023, 03:53 AM
RE: Two-dimensional array - by madscijr - 01-05-2023, 06:57 AM
RE: Two-dimensional array - by Kernelpanic - 01-06-2023, 03:44 PM
RE: Two-dimensional array - by mnrvovrfc - 01-05-2023, 03:36 AM
RE: Two-dimensional array - by mdijkens - 01-05-2023, 11:53 AM
RE: Two-dimensional array - by madscijr - 01-05-2023, 01:14 PM
RE: Two-dimensional array - by SMcNeill - 01-05-2023, 01:42 PM
RE: Two-dimensional array - by madscijr - 01-05-2023, 04:25 PM
RE: Two-dimensional array - by SpriggsySpriggs - 01-06-2023, 04:10 PM
RE: Two-dimensional array - by mdijkens - 01-07-2023, 10:48 AM



Users browsing this thread: 3 Guest(s)