Private Sub cmdSort_Click()
Dim I,J,arr(5) As Integer
For I = 0 To 4
arr(I) = CInt(txtarr(I))
Next
Logic To Sort
J = 0
For I = 0 To 4
For J = 4 To I + 1 Step -1
If arr (J) < arr (J - 1) Then
X = arr(J)
arr(J) = arr(J - 1)
arr(J - 1) = X
End If
Next
Next
For I = 0 To 4
txtOutput(I).Text = CStr(arr(I))
Next
End Sub
Private Sub cmdSort_LostFocus()
For I = 0 To 5
txtarr(I).Text = Clear
Next
End Sub
No comments:
Post a Comment