我如何打印出一个4×4格的二维数组,其中包含第一行的值1,2和3以及第一列的1,2,3?到目前为止,我已经制作了我的2D阵列,但我不确定如何将其打印到控制台。
这是我到目前为止所做的代码:
Module Module1
Dim OXGrid(3, 3) As String
Sub Main()
Initialise()
Console.Read()
End Sub
Sub Initialise()
Dim col, row As Integer
'label the columns
Console.WriteLine(OXGrid(0, 0) = "")
For col = 1 To 3
Console.WriteLine(OXGrid(0, col) = "" & col & "")
Next
'label the rows
For row = 1 To 3
Console.WriteLine(OXGrid(row, 0) = row & "")
Next
'initialise the grid
For row = 1 To 3
For col = 1 To 3
Console.WriteLine(OXGrid(row, col) = "")
Next
Next
End Sub
End Module