//Functions in VB
Function MAX(X As Double, Y As Double, Z As Double)
If (X > Y) And (X > Z) Then
MAX = X
ElseIf (Y > Z) And (Y > X) Then
MAX = Y
ElseIf (Z > X) And (Z > Y) Then
MAX = Z
Else
MsgBox "Nos are equal"
End If
End Function
Function MIN(X As Double, Y As Double, Z As Double)
If (X < Y) And (X < Z) Then
MIN = X
ElseIf (Y < Z) And (Y < X) Then
MIN = Y
ElseIf (Z < X) And (Z < Y) Then
MIN = Z
Else
MsgBox "Nos are equal"
End If
End Function
Private Sub cmdclick_Click()
Dim A As Double
Dim B As Double
Dim C As Double
A = txt1.Text
B = txt2.Text
C = txt3.Text
txtmax.Text = MAX(A, B, C)
txtmin.Text = MIN(A, B, C)
End Sub
No comments:
Post a Comment
Note: only a member of this blog may post a comment.