在一个一维数组中保存1至25的连续数字.然后分别按升序和降序显示数组的索引与值
来源:百度知道 编辑:UC知道 时间:2024/06/18 14:31:15
Dim a(1 to 25) as integer
Dim i as integer,s1 as string,s2 as string
for i = 1 to 25
a(i)=i
next
for i = lbound(a) to ubound(a)
s1=s1 & "Index=" & CStr(i) & " , Data=" & Cstr(a(i)) & vbcrlf
next
for i = ubound(a) to lbound(a) step -1
s2=s2 & "Index=" & CStr(i) & " , Data=" & Cstr(a(i)) & vbcrlf
next
msgbox "升序:" & vbcrlf & s1 & vbcrlf & "降序:" & vbcrlf & s2