ลักไก่ตรงไหนคับ โจทย์มีแค่นี้ ผมไม่เข้าใจตรงทีคำว่า (โปรแกรม 3 x 3) ผมเพิ่งเคยได้ยินนี่แหละ
ความหวัง!! ? ความหวังของมนุษยชาติ
คะแนน ? โกง ก็เป็นคะแนน แล้วมีความหมายอะไร
Date :
2012-01-10 18:22:29
By :
pjgunner.com
No. 8
Guest
Code (VB.NET)
Module Module1
Sub Main()
Dim myarr(2, 2) As Double
Dim arr1, arr2 As Integer
Dim I, J As Integer
arr1 = myarr.GetUpperBound(0)
arr2 = myarr.GetUpperBound(1)
myarr(I, J) = 1
For I = 1 To arr1
For J = 1 To arr2
WriteLine(myarr(0, 0) & " " & myarr(0, 1) & " " & myarr(0, 2))
WriteLine(myarr(1, 0) & " " & myarr(1, 1) & " " & myarr(1, 2))
WriteLine(myarr(2, 0) & " " & myarr(2, 1) & " " & myarr(2, 2))
Next J
Next I
Console.ReadKey()
End Sub
End Module
Module Module1
Sub Main()
Dim myarr(2, 2) As Integer
Dim arr1, arr2, i, j As Integer
arr1 = myarr.GetUpperBound(0)
arr2 = myarr.GetUpperBound(0)
For i = 1 To arr1
For j = 1 To arr2
WriteLine(myarr(i, j) & " " & myarr(i, j) & " " & myarr(i, j))
Next j
Next i
Console.ReadKey()
End Sub
End Module
Module Module1
Sub Main()
' Create an array.
Dim array(2) As Integer
array(0) = 100
array(1) = 10
array(2) = 1
For Each element As Integer In array
Console.WriteLine(element)
Next
End Sub
End Module
Module Module1
Sub Main()
Dim myarr(2, 2) As Integer
Dim i, j As Integer
'0 1 1
'1 0 1
'1 1 0
' Row 0
myarr(0, 0) = 0
myarr(0, 1) = 1
myarr(0, 2) = 1
' Row 1
myarr(1, 0) = 1
myarr(1, 1) = 0
myarr(1, 2) = 1
' Row 2
myarr(2, 0) = 1
myarr(2, 1) = 1
myarr(2, 2) = 0
' Print output
For i = 0 To myarr.GetUpperBound(0)
For j = 0 To myarr.GetUpperBound(1)
Console.Write(myarr(i, j).ToString() & " ")
Next j
Console.WriteLine()
Next i
Console.ReadKey()
Console.WriteLine()
'1 1 0
'1 0 1
'0 1 1
' This is an invert of the array.
' Print output
For i = myarr.GetUpperBound(0) To 0 Step -1
For j = 0 To myarr.GetUpperBound(1)
Console.Write(myarr(i, j).ToString() & " ")
Next j
Console.WriteLine()
Next i
Console.ReadKey()
End Sub
End Module