Task
Given an array of integers A = (ai), where i = (1,2,3, ..., n). Print the numbers that make up the increasing sequence.
For example: if A = {2,3,4,0, -1,2, -2,0,5}, the result is 2,3,4 and -1,2.
Numbers are entered into a separate text block, I did this part, but I have no idea how to solve the problem directly.
Code:
Dim n, nw, min, i As Integer Dim nws As String Dim Msi() As Integer Private Sub Command1_Click() If Text2.Text <> "" Then n = n + 1 nws = Text2.Text Text2.Text = "" nw = CInt(nws) nws = CStr(nw) If n = 1 Then Text1.Text = nws Else Text1.Text = Text1.Text + ", " + nws ReDim Preserve Msi(n - 1) Msi(n - 1) = nw End If End Sub Private Sub Command2_click() For i = 1 To n If Msi(n) < Msi(n - 1) Then Text3.Text = Text3.Text + ", " + Msi(n) + "," + Msi(n - 1) End If Next i End Sub