VB 编程矩阵乘法问题 5
Fori=1TonForj=n+1To2*nText6=Text6&Format(a(i,j),"0.000")&""NextjText6=Text6&vbCrLfNex...
For i = 1 To n
For j = n + 1 To 2 * n
Text6 = Text6 & Format(a(i, j), "0.000") & " "
Next j
Text6 = Text6 & vbCrLf
Next i
Case 6 '--------------------------------------------------------------------
ReDim g(7, 8)
For i = 1 To n
For j = 1 To n3
g(i, j) = 0
For k3 = 1 To m3
g(i, j) = g(i, j) - a(i, k3) * c(k3, j)
Next k3, j, i
For i = 1 To n
For j = 1 To n3
Text7 = Text7 & g(i, j) & " "
Next j
Text7 = Text7 & vbCrLf
Next i
程序部分图,问题出在a(i,k3)提示下标越界,整个程序中n=2,n3=1,m3=2,该怎么修改呢?
还有:
for i = 1 to 2 for i = 1 to2
for j = 2 to 3 for j = 1 to 2 这两者循环输入的矩阵a(i,j)都是2*2矩阵,只是j下标的范围不同么? 展开
For j = n + 1 To 2 * n
Text6 = Text6 & Format(a(i, j), "0.000") & " "
Next j
Text6 = Text6 & vbCrLf
Next i
Case 6 '--------------------------------------------------------------------
ReDim g(7, 8)
For i = 1 To n
For j = 1 To n3
g(i, j) = 0
For k3 = 1 To m3
g(i, j) = g(i, j) - a(i, k3) * c(k3, j)
Next k3, j, i
For i = 1 To n
For j = 1 To n3
Text7 = Text7 & g(i, j) & " "
Next j
Text7 = Text7 & vbCrLf
Next i
程序部分图,问题出在a(i,k3)提示下标越界,整个程序中n=2,n3=1,m3=2,该怎么修改呢?
还有:
for i = 1 to 2 for i = 1 to2
for j = 2 to 3 for j = 1 to 2 这两者循环输入的矩阵a(i,j)都是2*2矩阵,只是j下标的范围不同么? 展开
2个回答
2015-01-08
展开全部
二个问题:1、数组a()没有看见你在哪里定义了,因此a(i,k3)当然越界。2、Next k3, j, i不要偷懒,应该写成三个语句。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询