我有一数组,w(2,2,3,3,3,4,6,6,7,9)
我现只想取其没有重复的,即:w(2,3,4,6,7,9)
并按从小到大排序,ok
请那位高手给于指点.......
我现只想取其没有重复的,即:w(2,3,4,6,7,9)
并按从小到大排序,ok
请那位高手给于指点.......
解决方案 »
- VB dll如何制作,比如一个文件选择对话框控件,求救!!!
- 如何获得RichTextBox中一个OLE对象的坐标?
- 数据库路经找不到??(急急急)
- vb中如何把形如20060306000000000字符串变量转换成时间变量
- BBS评选即将结束,拥有80万会员的CSDN仅仅获得11000张左右的投票,同时在线就有5000多个网友的CSDN社区获得的支持非常可怜!
- 回调函数在VB的IDE环境中能运行,编译完成后只要回调函数一工作程序就退出?
- 急等高手 vb压缩access问题 提示找不到可安装的ISAM
- 一个项目,价格差别这么大,真是奇怪
- 请问有没有办法判断的一数是否为数字
- ras拨号
- 请问 vb 怎么样让函数返回一个二维数组?能给你例子吗?
- 请教!如何将vb与其它编译过的高级语言接口?
dim work(n) as integer
for i=0 to n
for j=i+1 to n
if w(i) <> w(j) then
w(k)=w(j)
k=k+1
else
w(k)=w(j)
end if
loop j
loop i
Private Sub Command1_Click() Dim strA() As String
Dim strB() As String
Dim strTemp As String
Dim i, j, k As Integer
strA() = Split("7,2,9,3,5,4,2,6,3,9", ",")
' ReDim strB(LBound(strA()) To UBound(strA()))
For i = LBound(strA()) To UBound(strA())
' del the same
If strA(i) <> "" Then
For j = i + 1 To UBound(strA())
If strA(j) <> "" Then
If strA(i) = strA(j) Then
strA(j) = ""
k = k + 1
End If
End If
Next j
End If
Next i
For i = LBound(strA()) To UBound(strA()) - 1
' reorder
For j = LBound(strA()) To UBound(strA()) - 1
If Val(strA(j)) > Val(strA(j + 1)) Then
strTemp = strA(j + 1)
strA(j + 1) = strA(j)
strA(j) = strTemp
End If
Next j
Next i
strTemp = ""
For i = LBound(strA()) To UBound(strA())
If strA(i) <> "" Then
strTemp = strTemp & strA(i) & ","
End If
Next i
strTemp = Left(strTemp, Len(strTemp) - 1)
MsgBox strTempEnd Sub
写的比较麻烦,希望能看到更好的代码。