急求!Visual Basic 2005的BMI(体重计算器)的程式编码!!! 谢谢谢谢你了!!!
答案:1 悬赏:50 手机版
解决时间 2021-04-07 22:33
- 提问者网友:沉默菋噵
- 2021-04-07 19:08
急求!Visual Basic 2005的BMI(体重计算器)的程式编码!!! 谢谢谢谢你了!!!
最佳答案
- 五星知识达人网友:人间朝暮
- 2021-04-07 20:16
Public Class Form1
Dim result As BIM
Dim intWeight As Double
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
Try
intWeight = (CInt(txtHeigh.Text) - 100)
Select Case Check(txtWeight.Text)
Case BIM.result
MsgBox("thin")
Case BIM.result1
MsgBox("fat")
Case BIM.result2
MsgBox("fit")
End Select
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Enum BIM As Integer
result = 0
result1 = 1
result2 = 2
End Enum
Function Check(ByVal weight As String) As BIM
If CDbl(weight) < (intWeight - 10) Then
Return BIM.result
ElseIf CDbl(weight) > (intWeight + 15) Then
Return BIM.result1
Else
Return BIM.result2
End If
End Function
End Class
这个列子对象只能用于成年人,因为儿童的BIM要涉及到规定的BIM格式(这个我还真不清楚)。如果要考虑全面的话,就要添加程序代码。O(∩_∩)O哈!时间有限,献丑了!
Dim result As BIM
Dim intWeight As Double
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
Try
intWeight = (CInt(txtHeigh.Text) - 100)
Select Case Check(txtWeight.Text)
Case BIM.result
MsgBox("thin")
Case BIM.result1
MsgBox("fat")
Case BIM.result2
MsgBox("fit")
End Select
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Enum BIM As Integer
result = 0
result1 = 1
result2 = 2
End Enum
Function Check(ByVal weight As String) As BIM
If CDbl(weight) < (intWeight - 10) Then
Return BIM.result
ElseIf CDbl(weight) > (intWeight + 15) Then
Return BIM.result1
Else
Return BIM.result2
End If
End Function
End Class
这个列子对象只能用于成年人,因为儿童的BIM要涉及到规定的BIM格式(这个我还真不清楚)。如果要考虑全面的话,就要添加程序代码。O(∩_∩)O哈!时间有限,献丑了!
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯