1樓:難得糊塗
private sub form_load()a = array(11,8,34,26,74)'從小到大排序
for i = 0 to ubound(a) - 1for i1 = i + 1 to ubound(a)if val(a(i)) > val(a(i1)) then t = a(i): a(i) = a(i1): a(i1) = t
next i1, i
end sub
'問了那麼多,還沒想明白嗎?^_^
2樓:司寇忻
dim a as variant
dim tmp as integer
a = array(11, 8, 34, 26, 74)for i = 0 to ubound(a)for j = 0 to ubound(a)if val(a(i)) < val(a(j)) thentmp = a(i)
a(i) = a(j)
a(j) = tmp
end if
next j
next i
設計VB程序,將陣列元素排序,設計乙個VB程式,將陣列元素排序
private sub command1 click dim a dim n as integer randomize n int 5 rnd 5 n的範圍為 5 9 是生成隨機數的個數 redim a n for i 1 to n a i int rnd 900 100 隨機的三位整數 next ...
VB給陣列 賦值,急急急,VB中給陣列元素賦初值
為定義陣列大小.需要先定義data2 list陣列大小 redim data2 list n n為指定值.vb中給陣列元素賦初值 有問題請追問,滿意請採納,新年快樂!加油!1 vb6定義陣列時不需要人為初始化陣列,它會自動把數值型陣列的每個元素初始化為0,把字串陣列的每個元素初始化為空串。2 如果你...
VB問題給定陣列a 10, 30,44,12, 13,77 ,試程式設計將其中的正數賦予給b陣列,負數賦給c陣列。急急急
正數賦予給b陣列,負數賦給c陣列的 dim a b c dim i as integer,m as integer,n as integer a array 10,30,44,12,13,77 print a陣列 for i 0 to ubound a print a i if a i 0 then...