| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 543 人关注过本帖
标题:为什么转置是老出现下标越界
只看楼主 加入收藏
落雨向冉
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-7-3
收藏
 问题点数:0 回复次数:0 
为什么转置是老出现下标越界
public Dim R1, R2, R3, R4, C1, C2, C3, C4 As Integer, a(), b(), c() As Double




Private Sub Command1_Click()
Dim a() As Integer

If IsNumeric(Text1) = False Or IsNumeric(Text2) = False Or Len(Text1) = 0 Or Len(Text2) = 0 Then
Exit Sub
End If
R1 = Val(Text1)
C1 = Val(Text2)
ReDim a(R1, C1)
For i = 1 To R1
   For j = 1 To C1
   a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
   
Next j
 
Next i
For i = 1 To R1
   For j = 1 To C1
 Text7.Text = Text7.Text & Str(a(i, j)) & Space(2)
 Next j
 Text7.Text = Text7.Text & vbCrLf
 Next i
End Sub

Private Sub Command2_Click()
R2 = Val(Text3)
C2 = Val(Text4)
ReDim a(R2, C2)
For i = 1 To R2
   For j = 1 To C2
   a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
   
Next j
 
Next i
For i = 1 To R2
   For j = 1 To C2
 Text8.Text = Text8.Text & Str(a(i, j)) & Space(2)
 Next j
 Text8.Text = Text8.Text & vbCrLf
 Next i
End Sub

Private Sub Command3_Click()
R3 = Val(Text5)
C3 = Val(Text6)
ReDim a(R3, C3)
For i = 1 To R3
   For j = 1 To C3
   a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
   
Next j
 
Next i
For i = 1 To R3
   For j = 1 To C3
 Text9.Text = Text9.Text & Str(a(i, j)) & Space(2)
 Next j
 Text9.Text = Text9.Text & vbCrLf
 Next i
End Sub

Private Sub Command4_Click()
R4 = Val(Text11)
C4 = Val(Text11)
ReDim a(R4, C4)
For i = 1 To R4
   For j = 1 To C4
   a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
    Next j
Next i
For i = 1 To R4
   For j = 1 To C4
 Text10.Text = Text10.Text & Str(a(i, j)) & Space(2)
 Next j
 Text10.Text = Text10.Text & vbCrLf
 Next i
End Sub

Private Sub Command5_Click()
ReDim c(C1, R1)
For i = 1 To R1
   For j = 1 To C1
   c(j, i) = a(i, j)这老出现下标越界
   Next j
   Next i
ReDim c(1 To C1, 1 To R1)
For i = 1 To C1
  For j = 1 To C2
  c(i, j) = c(i, j) + a(i, R1) * b(R1, j)
  Next j
  Text13.Text = Text13.Text & Str(c(i, j)) & Space(2)
  
  Next i
  Text13.Text = Text13.Text & vbCrLf
  


End Sub
搜索更多相关主题的帖子: public False Text1 Text2 
2013-07-03 14:00
快速回复:为什么转置是老出现下标越界
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038102 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved