'标准体重(kg)=身高(cm)-100上下可浮动5kg
If Val(Text2.Text) <Val(Text1.Text) - 100 - 5 Then
MsgBox "你的身体太瘦,请注意营养", , "太瘦"
ElseIf Val(Text2.Text) >= Val(Text1.Text) - 100 - 5 And Val(Text2.Text) <= Val(Text1.Text) - 100 + 5 Then
MsgBox "你的身体标准,请继续保持", , "标准"
ElseIf Val(Text2.Text) >Val(Text1.Text) - 100 + 5 Then
MsgBox "你的身体太胖,请注意减肥", , "太胖"
End If
End Sub
20 <= x <= 22vb不能连等 if x>=? and x<=? then
Private Sub Command1_Click()
Text3.Text = Round(Val(Text2.Text / (Text1.Text) ^ 2), 2)
Dim x
Picture1.Cls
x = Val(Text3.Text)
If 20 <= x And x <= 22 Then
Picture1.Print "最佳"
ElseIf 18.5 <= x And x <20 Then
Picture1.Print "正常"
ElseIf 22 <x And x <24 Then
Picture1.Print "正常"
ElseIf x <18.5 Then
Picture1.Print "偏瘦"
ElseIf 24 <= x And x <28 Then
Picture1.Print "超重"
Else
Picture1.Print "肥胖"
End If
End Sub
你的公式不对a/(b*2),我帮你改成a/(b*1.6),看起来差不多,实际公式是a=b-1.05是标准身材。 Private Sub Command1_Click()Dim a As Single, b As Single, c As Single
a = Val(Text1)
b = Val(Text2)
c = Round(a / (b * 1.6))
Label6.Caption = c
If Option1.Value Then
If c <20 Then
Label8.Caption = "过轻"
ElseIf c <25 Then
Label8.Caption = "适中"
ElseIf c <30 Then
Label8.Caption = "过重"
ElseIf c <35 Then
Label8.Caption = "肥胖"
ElseIf c >= 35 Then
Label8.Caption = "非常肥胖"
End If
Else
If c <19 Then
Label8.Caption = "过轻"
ElseIf c <24 Then
Label8.Caption = "适中"
ElseIf c <29 Then
Label8.Caption = "过重"
ElseIf c <34 Then
Label8.Caption = "肥胖"
ElseIf c >= 34 Then
Label8.Caption = "非常肥胖"
End If
End If
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)