如何用vb做一个8*9的矩阵再完成移位
123456788123456778123456678123455678123445678123345678122345678112345678当窗体加载时,在窗体中利用...
1 2 3 4 5 6 7 8
8 1 2 3 4 5 6 7
7 8 1 2 3 4 5 6
6 7 8 1 2 3 4 5
5 6 7 8 1 2 3 4
4 5 6 7 8 1 2 3
3 4 5 6 7 8 1 2
2 3 4 5 6 7 8 1
1 2 3 4 5 6 7 8
当窗体加载时,在窗体中利用一位数组移位的方法显示如图所示的结果 展开
8 1 2 3 4 5 6 7
7 8 1 2 3 4 5 6
6 7 8 1 2 3 4 5
5 6 7 8 1 2 3 4
4 5 6 7 8 1 2 3
3 4 5 6 7 8 1 2
2 3 4 5 6 7 8 1
1 2 3 4 5 6 7 8
当窗体加载时,在窗体中利用一位数组移位的方法显示如图所示的结果 展开
5个回答
展开全部
容易,写上代码就行。不过你得把要求写清楚。
更多追问追答
追问
1 2 3 4 5 6 7 8
8 1 2 3 4 5 6 7
7 8 1 2 3 4 5 6
6 7 8 1 2 3 4 5
5 6 7 8 1 2 3 4
4 5 6 7 8 1 2 3
3 4 5 6 7 8 1 2
2 3 4 5 6 7 8 1
1 2 3 4 5 6 7 8
当窗体加载时,在窗体中利用一位数组移位的方法显示如图所示的结果
追答
Private Sub Form_Click()
Dim i As Integer, j As Integer, A(7) As Integer, Temp As Integer
For i = 0 To 7
A(i) = i + 1
Print A(i);
Next i
For j = 1 To 8
Temp = A(7)
For i = 7 To 1 Step -1
A(i) = A(i - 1)
Next i
A(0) = Temp
For i = 0 To 7
Print A(i);
Next i
Next j
End Sub
展开全部
可以用数组,很方便的,用二维数组或一维数组都可以。如果用二维可以dim a(8,9),首行列可以不用,或者加option base 1。一维数组dim a(72).
使用时用两重循环
二维:
for i=1 to 8
for j=1 to 9
a(i,j).......
next j
next i
使用一重循环
for i=1 to 8
for j=1 to 9
a((i-1)*9+j).......
next j
next i
使用时用两重循环
二维:
for i=1 to 8
for j=1 to 9
a(i,j).......
next j
next i
使用一重循环
for i=1 to 8
for j=1 to 9
a((i-1)*9+j).......
next j
next i
追问
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
当窗体加载时,在窗体上打印如上所示三角矩阵,谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是追问问题的答案:
Private Sub Form_Click()
Dim N As Integer, I As Integer, J As Integer
Dim a() As Integer
Cls
N = 10
ReDim a(N, N)
For I = 1 To N
a(I, I) = 1
a(I, 1) = 1
Print Format(a(I, 1), "@@@@");
For J = 2 To I - 1
a(I, J) = a(I - 1, J - 1) + a(I - 1, J)
Print Format(a(I, J), "@@@@");
Next J
If I <> 1 Then Print Format(a(I, I), "@@@@") Else Print
Next I
End Sub
Private Sub Form_Click()
Dim N As Integer, I As Integer, J As Integer
Dim a() As Integer
Cls
N = 10
ReDim a(N, N)
For I = 1 To N
a(I, I) = 1
a(I, 1) = 1
Print Format(a(I, 1), "@@@@");
For J = 2 To I - 1
a(I, J) = a(I - 1, J - 1) + a(I - 1, J)
Print Format(a(I, J), "@@@@");
Next J
If I <> 1 Then Print Format(a(I, I), "@@@@") Else Print
Next I
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是追问问题的答案:
Private Sub Form_Click()
Dim N As Integer, I As Integer, J As Integer
Dim a() As Integer
Cls
N = 10
ReDim a(N, N)
For I = 1 To N
a(I, I) = 1
a(I, 1) = 1
Print Format(a(I, 1), "@@@@");
For J = 2 To I - 1
a(I, J) = a(I - 1, J - 1) + a(I - 1, J)
Print Format(a(I, J), "@@@@");
Next J
If I <> 1 Then Print Format(a(I, I), "@@@@") Else Print
Next I
End Sub
Private Sub Form_Click()
Dim N As Integer, I As Integer, J As Integer
Dim a() As Integer
Cls
N = 10
ReDim a(N, N)
For I = 1 To N
a(I, I) = 1
a(I, 1) = 1
Print Format(a(I, 1), "@@@@");
For J = 2 To I - 1
a(I, J) = a(I - 1, J - 1) + a(I - 1, J)
Print Format(a(I, J), "@@@@");
Next J
If I <> 1 Then Print Format(a(I, I), "@@@@") Else Print
Next I
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
编写一个小学数学模拟测验的程序。要求: 1、用户可以选择单独测验加法、减法这个做不出,你vb考试危险啊,毕竟要三个学分呢 才10分
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询