| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1762 人关注过本帖
标题:VB程序总是下标越界.看看为什么!
取消只看楼主 加入收藏
solitude1984
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-4-23
收藏
 问题点数:0 回复次数:2 
VB程序总是下标越界.看看为什么!

Private Sub Command1_Click()
Dim a, b, ni, c, ok, nmax, test As Integer
Dim cc, result, sum, suml, bound, G As Single
Dim p(2, 2) As Single
Dim q(2) As Single
Dim s(2) As Single
Dim s1(2) As Single
Dim N, M, i, j As Single
N = 2
M = 2
c = 1
result = 0
ni = 0
For i = 1 To N
For j = 1 To M
p(i, j) = InputBox("请输入数据")
Print p(i, j)
Next j
Next i
sum = 0
For j = 1 To M
For i = 1 To N
sum = sum + p(i, j)
Next i
Next j
If sum > 1 Then
Print "输入信道矩阵不正确,请重新输入信道矩阵!"
c = 1
i = N
End If
c = 0
For i = 1 To N 'a请输入迭代计算精度:'
q(i) = 1# / N
Next i
For i = 1 To N
Next i
s(i) = q(i)
For j = 1 To M
s(j) = 0
For i = 1 To N
s(j) = s(j) + s(i) * p(i, j)
Next i
Next j
For j = 1 To M
For i = 1 To N
p(i, j) = s(i) * p(i, j) / s(j)
Next i
Next j
End Sub

搜索更多相关主题的帖子: Dim VB Single sum Next 
2007-04-23 20:27
solitude1984
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-4-23
收藏
得分:0 

呵呵!谢谢各位,我试了一下通过了!

2007-04-24 08:41
solitude1984
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-4-23
收藏
得分:0 

谢谢了!我是新手,刚学着自己写,准备作毕设的!在百度花钱都没人甩!大家辛苦了!就是还有一个问题,改正后次程序还会溢出提示为这里:s(j) = s(j) + s(i) * p(i, j)

2007-04-24 08:52
快速回复:VB程序总是下标越界.看看为什么!
数据加载中...
 
   



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

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