VB用自定义函数实现给数组排序(选择法)急求!!

如题所述

dim i as integer,j as integer, a(1 to 100) as integer , n as integer,tmp as integer
'先给数组赋值,假设有100个数
for i=1 to 99
n=i
for j=i+1 to 100
if a(j)<a(n) then n=j '找出从第i个数到第100个数中最小的一个的序号
next j
tmp=a(i): a(i)=a(n): a(n)=tmp '将最小的数与第i个数换位
next i
温馨提示:答案为网友推荐,仅供参考
相似回答