谁会vb编程啊 帮帮我 谢谢拉

来源:百度知道 编辑:UC知道 时间:2024/06/23 02:46:49
题目如下
专家认为,标准体重计算公式应为:标准体重(kg)= 身高(cm)-105
正常体重应在标准体重±10%的范围内,否则就是偏瘦或偏胖。编程要求:输入身高与体重,给出此人的体重是在正常范围内,还是偏胖或偏瘦。

Private Sub Command1_Click()
Dim weight As Double
Dim hight As Double
Dim std As Double
Dim range As Double

weight = InputBox("输入体重kg")
hight = InputBox("输入身高cm")
std = hight - 105 '标准
range = std * 0.1 '允许范围
If weight >= range + std Then
MsgBox "偏胖"
Else
If weight <= std - range Then
MsgBox "偏瘦"
Else
MsgBox "正常"
End If
End If
End Sub