x=b(i)
for j=i-1 to 0 step -1
if b(j)>x then exit for
b(j+1)=b(j)
next j
b(j+1)=x
end if
next i

text1=‖‖
for i=0 to ubound(b,1)
text1=text1+str(b(i))+‖,‖
next i
end sub
运行程序后,文本框text1中的内容是:42, 35, 34, 13, 9, 6, 5,
10. 在窗体上画一个命令按钮command1,然后编写如下事件过程: private sub command1_click()
dim a(3,3)
for i=0 to 3
for j=0 to 3
a(i,j)=(i+1)*10+j
next j,i
for i=0 to 3
for j=0 to 3
if i<j then
x=a(i,j) :a(i,j)=a(j,i) : a(j,i)=x
end if
next j,i
for i=0 to ubound(a,1)
for j=0 to ubound(a,2)
print a(i,j);
next j
print10 20 30 40
vb试题及答案83_vb答案
next I11 21 31 41
end sub12 22 32 42
运行程序后,文本框text1中的内容是:13 23 33 43
11. 在窗体上画一个命令按钮command1,然后编写如下事件过程:
private sub command1_click()
dim arr1%(10),arr2(10)
n=3
for i=1 to 5
arr1(i)=i
arr2(n)=2*n+i
next i
print arr2(n);arr1(n)
end sub
程序运行后,单击command1,输出结果为:11 3
12. 在窗体上画一个命令按钮command1,然后编写如下事件过程:
private sub command1_click()
dim m%(10)
for k=1 to 10
m(k)=12-k
next k
x=6
print m(2+m(x))
end sub
程序运行后,单击command1,输出结果为:4
13. 在窗体上画一个命令按钮command1,然后编写如下事件过程:
private sub command1_click()
dim b
b=array(56,22,16,67,26,14,9,87)
do while k<ubound(b,1)
b(k)=b(k+1)
k=k+1
loop
print b(5)
end sub
程序运行后,单击command1,输出结果为:9
14. 在窗体上画一个命令按钮command1,然后编写如下事件过程:
private sub command1_click()
dim b,a(2,4)
b=array(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
for i=0 to 2
for j=0 to 4
a(i,j)=b(i*(ubound(a,2)+1)+i)
next j
next i
print b(i*(ubound(a,2)+1)-3)
end sub
程序运行后,单击command1,输出结果为:13
15. 在窗体上画一个命令按钮command1,然后编写如下事件过程:
private sub command1_click()
dim a(5 to 16)
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-22730-14.html
随便你们怎么说