Two-dimensional array
#3
Ok, here is the whole program, the whole attempt:

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

Option Base 1
Dim As Integer zahlenFeld(4, 3), feld(12)

Dim As Integer a, i, j, z
Dim As Integer zeile, spalte

Locate 2, 2
For a = 1 To 12
  feld(a) = a
  Print Using "## "; feld(a),
Next

Locate 4, 2

'Muss natuerlich mit etwas gefuellt werden!
'i + j sind nur fuer die Schleifensteuerung da.
z = 1
For i = 1 To 4
  For j = 1 To 3
    zahlenFeld(i, j) = z
    Print Using "## "; zahlenFeld(i, j),
    z = z + 1
  Next
  Print: Locate , 2
Next

Locate CsrLin + 2, 2
Input "Zeige Wert in Zeile # : ", zeile
Locate CsrLin + 0, 2
Input "Und in Spalte       # : ", spalte

Locate CsrLin + 1, 2

'Fehler bei falscher Eingabe abfangen - aber nur hier
If zeile > 4 Or spalte > 3 Then
  Print "Falsche Eingabe!"
  Sleep 2
  'Kehrt zum System zuruek
  System
Else
  Print Using "Wert in Zeile # und in Spalte # ist: ## "; zeile, spalte, zahlenFeld(zeile, spalte)
End If


'Aktuelle Zeilenkoordinate plus 3 als Argument von Locate.
'Das "Druecken Sie eine Taste" steht dann 3 Zeilen
'unter der letzten Position.
Locate CsrLin + 3, 2

End

Example:

[Image: Zweidim-Feld.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: 14 Guest(s)