| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1369 人关注过本帖
标题:求VB挂轮比代码
只看楼主 加入收藏
hl2388817942
Rank: 2
等 级:论坛游民
帖 子:9
专家分:10
注 册:2016-1-6
结帖率:100%
收藏
 问题点数:0 回复次数:0 
求VB挂轮比代码
(51/55)*(83/88)=.874586776859504

Dim a As Long, b As Long, c As Long, d As Long
Dim m As Double, n As Double
Dim k As Double

Dim a1 As Long, b1 As Long, c1 As Long, d1 As Long
Dim m1 As Double


k = 1
For a = 30 To 100
For b = 30 To 100
For c = 30 To 100
For d = 30 To 100
m = (a / b) * (c / d)
n = Abs(m - 0.8745865231)
If n < k Then
    k = n
    a1 = a
    b1 = b
    c1 = c
    d1 = d
    m1 = m
End If
Next d
Next c
Next b
Next a

Print "("; a1; "/"; b1; ")*("; c1; "/"; d1; ")="; m1
Debug.Print "(" & a1 & "/" & b1 & ")*(" & c1 & "/" & d1 & ")=" & m1


这个代码,我是在窗体有个text1.text,然后在text。text中输入实数,一般是小数点后七位,然后然后输出挂轮比,要求误差小于0.0002.这个程序不运行,大侠,看看应该怎么写,谢谢!
2016-01-17 12:52
快速回复:求VB挂轮比代码
数据加载中...
 
   



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

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