将一个10个元素的数组循环右移一位,若原数组中“1,2,3,4,5,6,7,8,9,10”,循环右移一位后“10,1,2,3,
4,5,6,7,8,9".privatesubcommand1_click()dimA(10)asinteger,kasinteger,tasintegerrandomi...
4,5,6,7,8,9".
private sub command1_click()
dim A(10) as integer, k as integer, t as integer
randomize
for k = 1 to 10
A(k) = int(90*rnd)+10
text1 = text1&str(A(k))
next
T=A(10)
for k=10 to 2 step -1
A(k) = A(k-1)
next
A(1) = T
For k = 1 to 10
text2 = text2&str(A(k))
next
end sub
这里的text1 = text1&str(A(k))是什么意思?
A(1) = T
For k = 1 to 10
text2 = text2&str(A(k))
是什么意思??? 展开
private sub command1_click()
dim A(10) as integer, k as integer, t as integer
randomize
for k = 1 to 10
A(k) = int(90*rnd)+10
text1 = text1&str(A(k))
next
T=A(10)
for k=10 to 2 step -1
A(k) = A(k-1)
next
A(1) = T
For k = 1 to 10
text2 = text2&str(A(k))
next
end sub
这里的text1 = text1&str(A(k))是什么意思?
A(1) = T
For k = 1 to 10
text2 = text2&str(A(k))
是什么意思??? 展开
展开全部
text1 = text1&str(A(k))就是把A(k)变为字符串再连接到text1的后面。因为原先text1没有赋过值,所以就是把所有的A(1)..A(10)前后连接起来。
A(1) = T
因为T就是原来的A(10),经过
for k=10 to 2 step -1
A(k) = A(k-1)
next
原来的A(1)..A(9)现已移动到A(2)..A(10),到此,已经完成了“将一个10个元素的数组循环右移一位”,最后,
For k = 1 to 10
text2 = text2&str(A(k))
就是就是把循环后的A(1)..A(10)前后连接起来变为字符串连接到text2中。
A(1) = T
因为T就是原来的A(10),经过
for k=10 to 2 step -1
A(k) = A(k-1)
next
原来的A(1)..A(9)现已移动到A(2)..A(10),到此,已经完成了“将一个10个元素的数组循环右移一位”,最后,
For k = 1 to 10
text2 = text2&str(A(k))
就是就是把循环后的A(1)..A(10)前后连接起来变为字符串连接到text2中。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询