Monday, March 22, 2010

Farm desigining

Private Sub Command1_Click()
Dim a(1 To 10) As String
Dim i, j, m As Integer
Dim t As String
N = InputBox("enter the total no. of crops")
For i = 1 To N
a(i) = InputBox("enter the total crops name")
list1.AddItem a(i)
nexti
For i = 1 To N - 1
For j = i+1 To N
If a(i) > a(j) Then
t = a(i)
a(i) = a(j)
a(j) = t
End If
Next i
Next j
Print "origional order;Ascending order"
For i = 1 To N
list2.AddItem a(i)
Next i
text 1=a(n)
text 2=a(n-1)
text 3=a(1)
text 4=a(2)
End Sub

No comments:

Post a Comment