以下是引用海狸先生在2005-11-3 19:41:00的发言:
第1个
Public Function fj()
Dim intGet(1, 2) As Integer, i As Integer, j As Integer, tmp As Integer
intGet(0, 0) = 12: intGet(1, 0) = 12
intGet(0, 1) = 8: intGet(1, 1) = 0
intGet(0, 2) = 5: intGet(1, 2) = 0
Debug.Print intGet(1, 0) & "," & intGet(1, 1) & "," & intGet(1, 2)
Do Until intGet(1, 1) = 6
For i = 0 To 2
If intGet(1, (i + 1) Mod 3) = 0 Then j = i: Exit For
Next
i = j
j = (i + 1) Mod 3
tmp = intGet(1, i) + intGet(1, j)
intGet(1, j) = IIf(intGet(0, j) < tmp, intGet(0, j), tmp)
intGet(1, i) = IIf(intGet(0, j) < tmp, tmp - intGet(0, j), 0)
Debug.Print intGet(1, 0) & "," & intGet(1, 1) & "," & intGet(1, 2)
Loop
End Function
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |