VB解释下面两句即可
第一,a(i)=((100-10)*rnd+10),100-10能不能直接用90
第二,解释下面两句即可
为什么i=1 to 9,
为什么j=1 to 10-i
for i=1 to 9
for j=1 to 10-i
if a(j)>a(j+1) then
private sub form_load()
dim a(1 to 10) as integer
dim i as integer
dim j as integer
dim temp as integer
print
print "排序前数组:";
for i=1 to 10
randomize
a(i)=((100-10)*rnd+10)
print a(i);" ";
next i
print
for i=1 to 9
for j=1 to 10-i
if a(j)>a(j+1) then
temp=a(j)
a(j)=a(j+1)
a(j+1)=temp
end if
next j
next i
print "排序后数且:";
for i=1 to 10
print a(i);" ";
next i
end sub
书本和你的都没有错,只不过我想知道
‘为什么i=1 to 9,
为什么j=1 to 10-i
理解不了,你知道吗,解释一下