Private Sub Command1_Click()
Dim n As Integer, L As Integer, t As Integer
Dim i As Integer, j As Integer, k As Integer
Dim s As String, result As String
Dim a(1 To 50) As Integer, dir(1 To 50) As Integer
L = Val(Text1.Text): n = Val(Text2.Text): t = Val(Text3.Text) s = Text4.Text
s = s + ".": tmp = 0: k=0
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "0" And ch <= "9" Then
tmp = tmp * 10 + Val(ch)
Else
k = k + 1
a(k) = tmp: dir(k) = 1
tmp = 0
End If
Next i
For i = 1 To t
For j = 1 To n
IfThen dir(j) = -dir(j)
Else
For c = 1 To n
IfThen dir(c) = (-1) * dir(c)
dir(j) = (-1) * dir(j)
End If
Next c
End If
Next j
Next i
For i = 1 To n
result = result + Str(a(i))
Next i
Label5.Caption = Str(t) + "秒后小球的位置为:" + result
End Sub