更新时间2019-04-01 16:17:37
Private Sub Command1_Click()
Dim h As Single, w As Single, BMI As Single
h = Val(InputBox("请输入身高(m):", "数据输入", 0))
w = Val(InputBox("请输入体重(kg):", "数据输入", 0))
c = w / h ^ 2
Dim msg, style, title, response, mystring
msg = "是否继续"
style = vbOKOnly
title = "结果输出"
rensponse = MsgBox(msg, style, title, "& c &")
If response < 18.5 Then
mystring = "偏瘦"
If response < 24 Then
mystring = "正常"
Else
mystring = "肥胖"
End If
End Sub
这个图片是问题,代码中那个数字判断还没打全。
前面的部分改下
Private Sub Command1_Click()
Dim h As Single, w As Single, BMI As Single
h = Val(InputBox("请输入身高(m):", "数据输入", 0))
w = Val(InputBox("请输入体重(kg):", "数据输入", 0))
c = w / h ^ 2
Dim msg, style, title, response, mystring
msg = "你的体重为"
style = vbOKOnly
title = "结果输出"
rensponse = MsgBox(msg & Str(c), style, title)
(后面的判断自己完成下)
上一篇:求助问题阿