作者fumizuki (蒙面加菲狮)
看板Visual_Basic
标题Re: [VB6 ] VB6.0 判断问题
时间Sun Feb 25 12:07:36 2007
※ 引述《wwth1 (wwth1)》之铭言:
: 我想请教一下大家
: 如果我现在有6个数字1,1,2,2,3,4
: 如果相同的数字只有显示一次
: 变成:n1=1
: n2=2
: n3=3
: n4=4
: 请问这样字该怎麽写呢??
: 麻烦一下各位大大了
Dim a1 As Variant, a2() As Variant
Dim i As Integer, j As Integer, c As Integer
Dim b As Boolean
a1 = Array(1, 1, 2, 2, 3, 4)
c = -1
For i = 0 To UBound(a1)
b = False
For j = 0 To c
If a1(i) = a2(j) Then b = True: Exit For
Next
If Not b Then
c = c + 1: Redim Preserve a2(c): a2(c) = a1(i)
Print a1(i)
End If
Next
--
▃▅▇▆▄ ▆▂▃ `
逝去感情如何能留住,半点痴情遗留殊不易,██▅▇▄▃ ▇▃▂" .
█████████▃i ▁▄▇
更多凄凄惨惨的遭遇…………██▆▃ █▅▆▃ˍ▄*
◢ ▂█▄▇▅▂▌.
我不知道,王~八~蛋~~! ▂▆███ █▄▃ 。fumizuki。Check。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.194.68.49
1F:推 wwth1:呵呵 太感谢你了 谢谢啦^^ 02/25 20:31