QB64 Phoenix Edition
Three-dimensional array - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7)
+---- Thread: Three-dimensional array (/showthread.php?tid=1363)

Pages: 1 2 3


Three-dimensional array - Kernelpanic - 01-03-2023

Structure and representation of a three-dimensional array. What could one do with it? For example: day, month, total sales . . . Nice!  Tongue
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.
[Image: Dreidimensionales-Feld2023.jpg]


RE: Three-dimensional array - bplus - 01-03-2023

Other than 3D models, you could do Row, column, page of a book?

Letter$(row, col, page) = a letter.


RE: Three-dimensional array - SpriggsySpriggs - 01-03-2023

For a simple "database". Table, row, column


RE: Three-dimensional array - mnrvovrfc - 01-03-2023

Three dimensions:
  1. front, mid, back seats
  2. driver or passenger's side
  3. which SUV.



RE: Three-dimensional array - SMcNeill - 01-03-2023

First, Middle, Last names in a 3D name database.


RE: Three-dimensional array - Kernelpanic - 01-03-2023

I see it and it reminds me of Charles Babbage. Misunderstood at the time, today its star shines bright and clear in the sky of internet technology.  Rolleyes

The day will come when the Third Dimensional Array will be named in the same breath as a Babbage or a Zuse.  Cool


RE: Three-dimensional array - TempodiBasic - 01-03-2023

Quote:Structure and representation of a three-dimensional array. What could one do with it? For example: day, month, total sales 
...

Good! How many items can be in the group of ternary set?
is it more mathematical question or more philosophical question?

hh: mm: ss  (time)

X:Y:Z  (3D space)

dd:mm:yyyy  (date)

ternar oxide/ salt/ acid   (chemical compound)

0 :1: 2  (ternary number system)

thesis antithesis synthesis  (Hegel)

quiet motion acceleration (Physics)

good   bad  man  (Ethics)

compiled  interpreted  bytecode (Informatic science)

child adult old (time evolution of man)

input  output state (information science)

earnings   losses  balance (economic computation)

incoming,  outcoming, total (economy:balance)

debit, credit,  total  (double entry bookkeeping)

and so on...


RE: Three-dimensional array - TempodiBasic - 01-03-2023

(01-03-2023, 07:56 PM)SMcNeill Wrote: First, Middle, Last names in a 3D name database.

Name, Date of birth, Sex in a friend database   in which Name is compound by First, Middle, Last names


RE: Three-dimensional array - Kernelpanic - 01-04-2023

Well, I can't think of a practical application right now. Maybe something for mathematicians who can store three-dimensional functions in it. It would be impractical for a "normal" database. I would take two or three records that access each other. For example:

Code: (Select All)
Type employee
   firstName As String * 20
   lastName As String * 20
   birthday As As String * 10
EndType

Type function
   programmer As employee
   salary as employee
   . . .
EndType

The 3D array is a nice exercise, and I haven't found anywhere that shows a graphical representation of a 3D array.


RE: Three-dimensional array - SMcNeill - 01-04-2023

(01-04-2023, 10:12 PM)Kernelpanic Wrote: Well, I can't think of a practical application right now. Maybe something for mathematicians who can store three-dimensional functions in it. It would be impractical for a "normal" database. I would take two or three records that access each other. For example:

Code: (Select All)
Type employee
   firstName As String * 20
   lastName As String * 20
   birthday As As String * 10
EndType

Type function
   programmer As employee
   salary as employee
   . . .
EndType

The 3D array is a nice exercise, and I haven't found anywhere that shows a graphical representation of a 3D array.


[Image: E03494-F0-F637-4-CE6-B738-1-E35-BBD20-ADF.png]