ButtonLeft里面写: Randomize Dim i As Long For i = 1 To Val(txt元素个数.Text) txt数组A.Text = txt数组A.Text & Int(Rnd() * 10) & " " txt数组B.Text = txt数组B.Text & Int(Rnd() * 10) & " " Next ButtonRight里面写: Dim a1() As String Dim a2() As String a1 = Split(Trim(txt数组A.Text), " ") a2 = Split(Trim(txt数组B.Text), " ") Dim i As Long Dim Max As Long Max = UBound(a1) If UBound(a2) < Max Then Max = UBound(a2) For i = 0 To Max txt数组C.Text = txt数组C.Text & Val(a1(i)) + Val(a2(i)) & " " Next
Randomize
Dim i As Long
For i = 1 To Val(txt元素个数.Text)
txt数组A.Text = txt数组A.Text & Int(Rnd() * 10) & " "
txt数组B.Text = txt数组B.Text & Int(Rnd() * 10) & " "
Next
ButtonRight里面写:
Dim a1() As String
Dim a2() As String
a1 = Split(Trim(txt数组A.Text), " ")
a2 = Split(Trim(txt数组B.Text), " ")
Dim i As Long
Dim Max As Long
Max = UBound(a1)
If UBound(a2) < Max Then Max = UBound(a2)
For i = 0 To Max
txt数组C.Text = txt数组C.Text & Val(a1(i)) + Val(a2(i)) & " "
Next