01-03-2023, 06:39 PM
(This post was last modified: 01-03-2023, 06:44 PM by Kernelpanic.)
Structure and representation of a three-dimensional array. What could one do with it? For example: day, month, total sales . . . Nice!
Oh yes, wrong inputs are not caught yet.
Ebene = level, Zeile = row, Spalte = column
Straight and oblique version.
Oh yes, wrong inputs are not caught yet.
Ebene = level, Zeile = row, Spalte = column
Code: (Select All)
'Dreidimensionales Feld mit graphischer Darstellung - 3. Jan. 2023
$Console:Only
Option _Explicit
Option Base 1
Dim As Integer dreiDimFeld(3, 4, 4)
'"dm" legt die Dimension(Ebenen) fest. Hier dreimal Bloecke a 16
'dz ist Anzahl Zeilen, ds ist Anzahl Spalten
Dim As Integer dm, dz, ds, dFeld
Dim As Integer ebene, zeile, spalte
Locate 2, 2
'Der Ablauf ist: 1te Ebene -> Durchlauf Zeile * Spalte
'dann folgt die naechste Ebene usw. so viele Ebenen
'wie vorhanden sind
dFeld = 1
For dm = 1 To 3
For dz = 1 To 4
'Nach jedem sechszehner Block Absatz
'fuer naechsten Block. Csrlin+1 statt 2 -> schraege Anzeige
Locate CsrLin + 1, CsrLin + 1
For ds = 1 To 4
dreiDimFeld(dm, dz, ds) = dFeld
Print Using "## "; dreiDimFeld(dm, dz, ds),
dFeld = dFeld + 1
Next
Next
Print: Locate , 2
Next
Locate CsrLin + 2, 2
Input "Zeige Wert in Ebene : ", ebene
Locate CsrLin + 0, 2
Input "Zeige Wert in Zeile : ", zeile
Locate CsrLin + 0, 2
Input "Und in Spalte : ", spalte
Locate CsrLin + 1, 2
Print Using "Wert in Ebene: # Zeile: # Spalte: # ist: ##"; ebene, zeile, spalte, dreiDimFeld(ebene, zeile, spalte)
End
Straight and oblique version.