求从杂乱无章的数列中提取非降序数列段的算法
如题。。。 想了几天也没明白 这是我的算法 但是有问题 不知道问题在哪 还望指教
Private Sub Command1_Click()
'Dim counter As Integer, i As Integer, x As Integer
Open App.Path & "\数据.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, temp
x = x + 1
Loop
Close #1
'Dim sj(60000)
i = 1
Open App.Path & "\数据.txt" For Input As #2
While Not EOF(2)
Input #2, sj(i)
i = i + 1
Wend
Close #2
For counter = 1 To x - 1
'Select Case sj(counter)
'Case Is <= sj(counter + 1) And Text1.Text <> ""
'Text1.Text = Text1.Text & vbNewLine & sj(counter)
'GoTo end_:
'Case Is <= sj(counter + 1) And Text1.Text = ""
'Text1.Text = sj(counter)
'GoTo end_:
'Case Is >= sj(counter - 1) And sj(counter) <= sj(counter + 1) And Text1.Text <> ""
' Text1.Text = Text1.Text & vbNewLine & sj(counter)
'GoTo end_:
'Case Is >= sj(counter - 1) And sj(counter) <= sj(counter + 1) And Text1.Text = ""
'Text1.Text = sj(counter)
'GoTo end_:
'end_:
'End Select
If sj(counter) <= sj(counter + 1) And Text1.Text <> "" Then
Text1.Text = Text1.Text & vbNewLine & sj(counter)
ElseIf sj(counter) <= sj(counter + 1) And Text1.Text = "" Then
Text1.Text = sj(counter)
ElseIf sj(counter) >= sj(counter - 1) And sj(counter) <= sj(counter + 1) And Text1.Text <> "" Then
Text1.Text = Text1.Text & vbNewLine & sj(counter)
ElseIf sj(counter) >= sj(counter - 1) And sj(counter) <= sj(counter + 1) And Text1.Text = "" Then
Text1.Text = sj(counter)
End If
Next
End Sub