[填空題] 下面的程序代碼實現(xiàn)將一個一維數(shù)組中元素向右循環(huán)移動,移位次數(shù)由文本框Text1輸入。例如數(shù)組各元素的值依次為0, 1, 2, 3, 4, 5, 6,
2021-07-20
[填空題] 下面的程序代碼實現(xiàn)將一個一維數(shù)組中元素向右循環(huán)移動,移位次數(shù)由文本框Text1輸入。例如數(shù)組各元素的值依次為0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10; 移動三次后,各元素的值依次為 8, 9, 10, 0, 1,2 3,4,5,6,7。
Private Sub MoveRight (x() As Integer)
Dim i As Integer
Dim j As Integer
Dim k As Integer
i = UBound (x)
j = x(i)
For k = i To 【7】 Step -1
【8】
Next k
x(LBeund(x)) = j
End Sub
Private Sub Command1_click()
Dim a(10) As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
For i = 0 To 10
a(i) = i
Next i
j = Val(Text1. Text)
k=0
Do
k=k+1
Call MoveRight(a)
Loop Until k = j
For i = 0 To 10
Print a(i);
Next i
End Sub
正確答案:[7] LBound (x)+1 [8] x(k)=x(k-1)
詞條內(nèi)容僅供參考,如果您需要解決具體問題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。