注册 登录
编程论坛 VB6论坛

新手上路,求大神指点此段程序错误

a975330185 发布于 2013-04-26 22:46, 395 次点击
Private Sub Command2_Click()
Dim Q1 As Single, Q2 As Single, Q3 As Single, Q As Single
Dim i, j
Form2.Show
Form2.Print
Form2.Print "角度", "长度", "最大叉装量"
a1 = Val(Text6.Text) / 10 ^ 12
b1 = Val(Text7.Text) / 10 ^ 12
a2 = Val(Text13.Text) / 10 ^ 12
b2 = Val(Text14.Text) / 10 ^ 12
a3 = Val(Text20.Text) / 10 ^ 12
b3 = Val(Text21.Text) / 10 ^ 12
c = Val(Text22.Text) * 10 ^ 6

For i = (-1 / 90) * 3.14 To (7 / 18) * 3.14 Step 0.02
    Form2.Print i
    For l = 5.6 To 13.3 Step 0.2
     If l = 5.6 Then
         Q1 = ((c / 1.33) - (5.4 * 10 ^ 3 * Sin(i) + (44 / 3) * 10 ^ 3 * Cos(i) * (l - 2.7)) * b1 - 1750 * a1) / (1.08 * Sin(i) * b1 + 1.2 * Cos(i) * (l - 2.7) * b1 + 0.05 * (l - 2.7) * a1)
       ElseIf l > 5.6 Then
         Q2 = ((c / 1.33) - (5.4 * 10 ^ 3 * Sin(i) + (44 / 3) * 10 ^ 3 * Cos(i) * (13.3 - (l - 0.5))) * b2 - 1750 * a2) / (1.08 * Sin(i) * b2 + 1.2 * Cos(i) * (13.3 - (l - 0.5)) * b2 + 0.05 * (13.3 - (l - 0.5)) * a2)
         Q3 = ((c / 1.33) - (5.4 * 10 ^ 3 * Sin(i) + (44 / 3) * 10 ^ 3 * Cos(i) * ((13.3 - (l - 0.5)) / 2 - 0.2)) * b3 - 1750 * a3) / (1.08 * Sin(i) * b3 + 1.2 * Cos(i) * ((13.3 - (l - 0.5)) / 2 - 0.2) * b3 + 0.05 * ((13.3 - (l - 0.5)) / 2 - 0.2) * a3)
    End If
        If Q1 < Q2 Then
         Q = Q1
        Else
         Q = Q2
        End If
        If Q3 < Q Then
         Q = Q3
         End If
        Form2.Print i, l, Q
        Next l
Next i
End Sub
0 回复
1