你回答的一道程序设计题:vb产生一个6×6的转置矩阵,将二维数组中所有行和对应列的元素进行交换。
Dimczjl(5,5)AsBoolean'转置过程记录Form=0To5Forn=0To5Ifczjl(m,n)=FalseThentmp=a(m,n)'a是你需要转置...
Dim czjl(5, 5) As Boolean '转置过程记录
For m = 0 To 5
For n = 0 To 5
If czjl(m, n) = False Then
tmp = a(m, n) 'a是你需要转置数组
a(m, n) = a(n, m)
a(n, m) = tmp
czjl(m, n) = True
czjl(n, m) = True
End If
Next
Next
我调试了一下说子程序或函数未定义,是为什么啊?求解 展开
For m = 0 To 5
For n = 0 To 5
If czjl(m, n) = False Then
tmp = a(m, n) 'a是你需要转置数组
a(m, n) = a(n, m)
a(n, m) = tmp
czjl(m, n) = True
czjl(n, m) = True
End If
Next
Next
我调试了一下说子程序或函数未定义,是为什么啊?求解 展开
展开全部
那应该是你的数组的问题吧,
也就是a(m, n),这需要赋值的,下面是一个实例
Private Sub Command1_Click()
Dim a(5, 5)
'赋值
For m = 0 To 5
For n = 0 To 5
a(m, n) = n
Print a(m, n);
Next
Print
Next
Print
Print
Dim czjl(5, 5) As Boolean '转置过程记录
For m = 0 To 5
For n = 0 To 5
If czjl(m, n) = False Then
tmp = a(m, n) 'a是你需要转置数组
a(m, n) = a(n, m)
a(n, m) = tmp
czjl(m, n) = True
czjl(n, m) = True
End If
Next
Next
'转制以后打印
For m = 0 To 5
For n = 0 To 5
'a(m, n) = n
Print a(m, n);
Next
Print
Next
End Sub
也就是a(m, n),这需要赋值的,下面是一个实例
Private Sub Command1_Click()
Dim a(5, 5)
'赋值
For m = 0 To 5
For n = 0 To 5
a(m, n) = n
Print a(m, n);
Next
Next
Dim czjl(5, 5) As Boolean '转置过程记录
For m = 0 To 5
For n = 0 To 5
If czjl(m, n) = False Then
tmp = a(m, n) 'a是你需要转置数组
a(m, n) = a(n, m)
a(n, m) = tmp
czjl(m, n) = True
czjl(n, m) = True
End If
Next
Next
'转制以后打印
For m = 0 To 5
For n = 0 To 5
'a(m, n) = n
Print a(m, n);
Next
Next
End Sub
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询