Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
|
|
@ -0,0 +1,39 @@
|
|||
Sub map(f As Function(As Integer) As Integer, arr() As Integer, result() As Integer)
|
||||
For i As Integer = Lbound(arr) To Ubound(arr)
|
||||
result(i) = f(arr(i))
|
||||
Next i
|
||||
End Sub
|
||||
|
||||
Function timestwo(n As Integer) As Integer
|
||||
Return n * 2
|
||||
End Function
|
||||
|
||||
Function squared(n As Integer) As Integer
|
||||
Return n ^ 2
|
||||
End Function
|
||||
|
||||
Sub printArray(arr() As Integer)
|
||||
For i As Integer = Lbound(arr) To Ubound(arr)
|
||||
Print arr(i);
|
||||
If i < Ubound(arr) Then Print ",";
|
||||
Next i
|
||||
Print
|
||||
End Sub
|
||||
|
||||
Dim As Integer arr1(3) = {0, 1, 2, 3}
|
||||
Dim As Integer arr2(3) = {2, 4, 6, 8}
|
||||
Dim As Integer result(3)
|
||||
|
||||
map(@timestwo, arr1(), result())
|
||||
printArray(result())
|
||||
|
||||
map(@squared, arr1(), result())
|
||||
printArray(result())
|
||||
|
||||
map(@timestwo, arr2(), result())
|
||||
printArray(result())
|
||||
|
||||
map(@squared, arr2(), result())
|
||||
printArray(result())
|
||||
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue