如何在vb6.0中编制能够返回两个整型数中较大数的函数?
2个回答
展开全部
Function max(a As Integer, b As Integer) As Integer
Dim tmp As Integer
If a < b Then
tmp = b
Else
tmp = a
End If
max = tmp
End Function
Private Sub CommandButton1_Click()
Dim a As Integer
Dim b As Integer
a = 16
b = 15
MsgBox max(a, b)
End Sub
上面是函数,下面是调用
Dim tmp As Integer
If a < b Then
tmp = b
Else
tmp = a
End If
max = tmp
End Function
Private Sub CommandButton1_Click()
Dim a As Integer
Dim b As Integer
a = 16
b = 15
MsgBox max(a, b)
End Sub
上面是函数,下面是调用
展开全部
跟上面差不多。
Function max(a As Integer, b As Integer) As Integer
If a < b Then
max = b
Else
max = a
End If
End Function
Private Sub Command1_Click()
Dim x As Integer
Dim y As Integer
x = 11
y = 15
MsgBox max(x, y)
End Sub
Function max(a As Integer, b As Integer) As Integer
If a < b Then
max = b
Else
max = a
End If
End Function
Private Sub Command1_Click()
Dim x As Integer
Dim y As Integer
x = 11
y = 15
MsgBox max(x, y)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询