 
- 帖子
- 6388
- 积分
- 18843
- 技术
- 982
- 捐助
- 100
- 注册时间
- 2010-10-9
|
回复 2# ivor
Dim Arr() 声明的是动态数组
------------------------------------------------------------
仔细看了下楼主的代码,有几个问题
Option Explicit
Dim Arr()
Dim A,B,C
Dim j
B=InputBox("Now,Please writing B")'元素数
For A=0 To B-1'输入元素值
ReDim Preserve Arr(A+1)
Arr(A)= InputBox("Now,Please writing A as well")
Arr(A)= Int(Arr(A))
If IsNumeric(Arr(A))=True then'处理意外
Else
WScript.Quit
End If
Next
B1'调用
For j=0 To B-1'结果
C=C&" "&Arr(j)
Next
WScript.Echo C
Function B1
Dim i,n,t
For i = 0 To B-1'排序
For n = i To B
If Arr(i) < Arr(n) Then
t = Arr(i)
Arr(i) = Arr(n)
Arr(n) = t
End If
Next
Next
End Function |
|