| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 291 人关注过本帖
标题:各位高手,请帮忙持下这代码那里有问题,谢谢!
只看楼主 加入收藏
wyq7826275
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-1-15
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
各位高手,请帮忙持下这代码那里有问题,谢谢!

Private Sub Command1_Click()
Dim q As Double
Dim k As Double
Dim λ As Double
Dim date_q(10000) As Double
Dim b As Double
Dim i As Double
q = Text1
k = Text2
For i = 0 To 10000
    λ = i / 10000
    b = ((k + 1) / 2) ^ (1 / (k - 1)) * λ * (1 - (k - 1) / (k + 1) * λ * λ) ^ (1 / (k - 1))
    date_q(i) = b
Next i
For i = 0 To 10000
     If q > date_q(i) Then Next i
     If q = date_q(i) Then Exit For
     If q < date_q(i) Then Exit For
λ = (i - (date_q(i) - q) / (date_q(i) - date_q(i - 1))) / 10000
Text3.Text = λ
End Sub
搜索更多相关主题的帖子: 10000 
2013-01-15 16:22
lowxiong
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:27
帖 子:652
专家分:3402
注 册:2008-5-7
收藏
得分:10 
for next是唯一对应的语句对,不能单独作为条件语句执行,你的If q > date_q(i) Then Next i是不符合语法规范的,应改为
For i = 0 To 10000
'这一句去掉,既然小于或等于都跳出循环,那么进入循环的必然是大于     If q > date_q(i) Then Next i
'这一句也可去掉,因为VB有<=的关系符     If q = date_q(i) Then Exit For
     If q <= date_q(i) Then Exit For
next
2013-01-15 18:06
yz1025
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:6
帖 子:491
专家分:919
注 册:2012-10-26
收藏
得分:10 
以下是引用wyq7826275在2013-1-15 16:22:00的发言:


Private Sub Command1_Click()
Dim q As Double
Dim k As Double
Dim λ As Double
Dim date_q(10000) As Double
Dim b As Double
Dim i As Double
q = Text1
k = Text2
For i = 0 To 10000
    λ = i / 10000
    b = ((k + 1) / 2) ^ (1 / (k - 1)) * λ * (1 - (k - 1) / (k + 1) * λ * λ) ^ (1 / (k - 1))
    date_q(i) = b
Next i
For i = 0 To 10000
     If q > date_q(i) Then Next i
     If q = date_q(i) Then Exit For
     If q < date_q(i) Then Exit For
λ = (i - (date_q(i) - q) / (date_q(i) - date_q(i - 1))) / 10000
Text3.Text = λ
End Sub


图解~Win7的装这软件显示不正常~将就点吧~
图片附件: 游客没有浏览图片的权限,请 登录注册

不要投我
2013-01-15 21:55
快速回复:各位高手,请帮忙持下这代码那里有问题,谢谢!
数据加载中...
 
   



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

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