展开全部
在窗体上添加一个按钮,然后输入如下的程序,即可。
Private Sub Command1_Click()
Dim a(10) As Integer
Dim i As Integer
Dim temp As Integer
For i = 1 To 10
a(i) = i
Print i;
Next i
Print
temp = a(1)
For i = 1 To 9
a(i) = a(i + 1)
Print a(i);
Next i
a(10) = temp
Print a(10)
End Sub
如果需要换成自己的数据,则需要把a(i)=i修改,例如a(i)=InputBox("请输入数据:"),就可以了。
Private Sub Command1_Click()
Dim a(10) As Integer
Dim i As Integer
Dim temp As Integer
For i = 1 To 10
a(i) = i
Print i;
Next i
temp = a(1)
For i = 1 To 9
a(i) = a(i + 1)
Print a(i);
Next i
a(10) = temp
Print a(10)
End Sub
如果需要换成自己的数据,则需要把a(i)=i修改,例如a(i)=InputBox("请输入数据:"),就可以了。
展开全部
很容易实现!!
var n as integer
m=a(1)
for i =1 to 9
n=a(i)
a(i)=a(i+1)
a(i+1)=n
next
..........
下面是我在电子表格中进行的测试:
Dim a(10) As Integer
Sub yu()
For i = 1 To 10
a(i) = i
Cells(i, 1) = a(i)
Next
Dim n As Integer
For i = 1 To 9
n = a(i)
a(i) = a(i + 1)
a(i + 1) = n
Next
For i = 1 To 10
Cells(i, 3) = a(i)
Next
End Sub
测试结果:
测试前 测试后
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
========================================
您的问题==我的课题 奉献知识==辉煌生命
黑龙江省 张志晨
========================================
var n as integer
m=a(1)
for i =1 to 9
n=a(i)
a(i)=a(i+1)
a(i+1)=n
next
..........
下面是我在电子表格中进行的测试:
Dim a(10) As Integer
Sub yu()
For i = 1 To 10
a(i) = i
Cells(i, 1) = a(i)
Next
Dim n As Integer
For i = 1 To 9
n = a(i)
a(i) = a(i + 1)
a(i + 1) = n
Next
For i = 1 To 10
Cells(i, 3) = a(i)
Next
End Sub
测试结果:
测试前 测试后
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
========================================
您的问题==我的课题 奉献知识==辉煌生命
黑龙江省 张志晨
========================================
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询