當前位置:編程學習大全網 - 電腦編程 - 用vb做測BMI的程序

用vb做測BMI的程序

20 <= x <= 22

vb不能連等 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

  • 上一篇:WINFORM 左右各50%的布局問題
  • 下一篇:vba數組和vbasql哪個快
  • copyright 2024編程學習大全網