| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1742 人关注过本帖
标题:求解下列式子,如何在VB里实现?
只看楼主 加入收藏
sunshine8639
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-3-28
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
求解下列式子,如何在VB里实现?
wcao = (i * 0.0907 + j) / 100
   wtio = (i * 0.0178 + k * 0.062) / 100
   walo = (i * 0.2418 + k * 0.64) / 100
   wfeo = (i * 0.0479 + k * 0.024) / 100
   wsio = (i * 0.4449 + k * 0.178) / 100
   wso = (i * 0.09 + k * 0.031) / 100
   cm = (wcao - 0.7 * wtio) / ((0.73 * (walo - 0.64 * wfeo) + 1.4 * wfeo + 1.87 * wsio))
   P = (walo - 0.64 * wfeo) / wso
   N = (walo - 0.64 * wfeo) / wsio
 满足 0.95 <= cm <= 0.99
            3.8 <= P <= 3.82
              1 <= N <= 1.3
            i + j + k = 100
 就是i,j,k分别得百分比。
搜索更多相关主题的帖子: 如何 
2016-03-28 16:47
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:20 
这一堆式子,我跑了一遍,没结果。

结果.rar (45.51 KB)


程序代码:
Option Explicit

Private Sub Command1_Click()

Dim i As Long, j As Long, k As Long

Dim wcao As Double, wtio As Double, walo As Double, wfeo As Double
Dim wsio As Double, wso As Double, cm As Double, P As Double, N As Double

Dim s As String

For i = 1 To 97
    For j = 1 To 99 - i
        k = 100 - i - j
        wcao = (i * 0.0907 + j) / 100
        wtio = (i * 0.0178 + k * 0.062) / 100
        walo = (i * 0.2418 + k * 0.64) / 100
        wfeo = (i * 0.0479 + k * 0.024) / 100
        wsio = (i * 0.4449 + k * 0.178) / 100
        wso = (i * 0.09 + k * 0.031) / 100
        cm = (wcao - 0.7 * wtio) / ((0.73 * (walo - 0.64 * wfeo) + 1.4 * wfeo + 1.87 * wsio))
        P = (walo - 0.64 * wfeo) / wso
        N = (walo - 0.64 * wfeo) / wsio
   
'满足 0.95 <= cm <= 0.99
'3.8 <= P <= 3.82
'1 <= N <= 1.3
   
        'If cm >= 0.95 And cm <= 0.99 And P >= 3.8 And P <= 3.82 And N >= 1 And N <= 1.3 Then
            s = s & "i=" & i & "  j=" & j & "  k=" & k & "  cm=" & Format(cm, "0.000") & "  P=" & Format(P, "0.000") & "  N=" & Format(N, "0.000") & vbCrLf
        'End If
    Next j
Next i

'Text1.Text = s

Open "d:\2.txt" For Output As #1
    Print #1, s
Close #1

End Sub

授人于鱼,不如授人于渔
早已停用QQ了
2016-03-28 18:36
sunshine8639
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-3-28
收藏
得分:0 
回复 2楼 风吹过b
感谢,感谢。只是居然是没有结果,我再回去看看是不是哪里错了。再次感谢
2016-03-28 20:20
快速回复:求解下列式子,如何在VB里实现?
数据加载中...
 
   



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

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