This code allows a user to enter numbers into a text box, stores those numbers in an array, sorts the array from lowest to highest value, and displays the sorted array in a second text box. It includes a button click event to trigger the sorting, stores user input in an array of size N, uses nested for loops to compare all array values and swap any out of order, and outputs the sorted array.
1 of 2
More Related Content
Ordenara los vectores
1. Publicclass fron 1
Pivatesub button1_click(byval sender as systeam,object,byval e as
System.eventargal) handles button1.click
Dim n,I,j, vectemp as integer
N=val(textbox1.text)
Dim vector (n) as integer
For i=1 TO N
VECTOR(I)=INPUTBOX(VECTOR& I)
NEXT I
FOR I=1 TO N
2. FOR J= 1 TO N-1
IF VECTOR (I)>VECTOR(J)THEM
VECTEMP=VECTOR(J)
VECTOR(i)=vector(i)
Vector(i)=vectemp
End if
Next
Next
For i= 1to n
Textbox2.text=textbox2.text & vector(i)&vbcrlf
Next i
End sub
Privatesub labe12_click(byval sender as system.object,buval e as
system.eventargs) handles label12.click
End sub