dim M(10) as integer
'产生11到30之前的数
for i=0 to 10
randomize
M(i)=Int((30-11+1)*Rnd+11)
next ifor i%=0 to 10  for j%=i+1 to 10
   
      if M(j)>=M(i) then         temp=M(j)
         M(j)=M(i)
         M(i)=temp
   
      end if
   
  next inext ifor i=0 to 10
debug.print M(i)
next

解决方案 »

  1.   

    若对一个数组串进行操作,如下:
    '分解
    s = Trim(" 17 14 18 15 16 19")
    v = Split(s, " ")
    '排序
    For i = 0 To UBound(v)
      For j = i + 1 To UBound(v)
          If Val(v(j)) >= Val(v(i)) Then
             d = v(j)
             v(j) = v(i)
             v(i) = d
          End If
      Next
    Next
    '合并
    s = Join(v, " ")
    Debug.Print s