Dim w!, h!, f!
w = Val(InputBox("请输入雀冲体升塌重千克数"))
h = Val(InputBox("请输入身高米数"))
f = w / (h * h)
If f <18.5 Then
Print "偏瘦!"
ElseIf f >= 18.5 And f <24.9 Then
Print "正常。"吵岁圆
ElseIf f >= 25 And f <= 30 Then
Print "偏胖。"
Else
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条)