Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,20 @@
Module Program
Sub Main()
Const ROWS = 10
Const COLS = 10
' Initialize with seed 0 to get deterministic output (may vary across .NET versions, though).
Dim rand As New Random(0)
' VB uses max index array declarations
Dim nums(ROWS - 1, COLS - 1) As Integer
For r = 0 To ROWS - 1
For c = 0 To COLS - 1
nums(r, c) = rand.Next(0, 21) ' Upper bound is exclusive.
Next
Next
' MISSING IMPLEMENTATION
End Sub
End Module

View file

@ -0,0 +1,8 @@
For r = 0 To ROWS - 1
For c = 0 To COLS - 1
Dim val = nums(r, c)
Console.WriteLine(val)
If val = 20 Then GoTo BREAK
Next
Next
BREAK:

View file

@ -0,0 +1,9 @@
Do
For r = 0 To ROWS - 1
For c = 0 To COLS - 1
Dim val = nums(r, c)
Console.WriteLine(val)
If val = 20 Then Exit Do
Next
Next
Loop While False

View file

@ -0,0 +1,9 @@
For r = 0 To ROWS - 1
Dim c = 0
Do While c <= COLS - 1
Dim val = nums(r, c)
Console.WriteLine(val)
If val = 20 Then Exit For
c += 1
Loop
Next

View file

@ -0,0 +1,10 @@
Sub Find20Impl(arr As Integer(,))
For r = 0 To arr.GetLength(0) - 1
For c = 0 To arr.GetLength(1) - 1
Dim val = arr(r, c)
Console.WriteLine(val)
If val = 20 Then Exit Sub
'If val = 20 Then Return ' Equivalent to above.
Next
Next
End Sub

View file

@ -0,0 +1 @@
Find20Impl(nums)

View file

@ -0,0 +1,10 @@
For r = 0 To ROWS - 1
For c = 0 To COLS - 1
Dim val = nums(r, c)
Console.WriteLine(val)
If val = 20 Then
r = ROWS
Exit For
End If
Next
Next

View file

@ -0,0 +1,12 @@
Dim done = False
For r = 0 To ROWS - 1
For c = 0 To COLS - 1
Dim val = nums(r, c)
Console.WriteLine(val)
If val = 20 Then
done = True
Exit For
End If
Next
If done Then Exit For
Next