Home > Software engineering >  Help to find the same program, to see the sample
Help to find the same program, to see the sample

Time:10-29

This is looking for the same program example
Data is given as follows:
Data 1 2,3,4,9,10,11,15,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2 Data 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
No. 3, the Data of 4,5,7,8,9,10,13,14,15,16,17,18,19,20,22,24,25,26,27,28,29,0,0,0,0,0,0,0,0,0,0,0,0
4 Data 2,3,4,9,10,11,15,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5 Data 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
6 Data 2,3,4,9,10,11,15,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
7 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data
8 Data 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 1 9,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,30,31,32,33,0,0,0,0
10 Data 4,5,7,8,9,10,13,14,15,16,17,18,19,20,22,24,25,26,27,28,29,0,0,0,0,0,0,0,0,0,0,0,0
Looking for the same methods to analyze algorithm (analysis) :
The first output:
1, for ease of analysis I compile a number on each, as above.
2, start looking for the same, first of all, the first and second lines (no. 1 and no. 2) compare, lines 1 and 2 are not identical; Line 1 and line 3 is again, also not the same; Compared to line 1 and line 4, this is the same two lines, then the output of a line, when the first row and after finishing all the rows below comparison; In line 2 and line 3 comparison, and so on, this kind of output results are as follows:
The first output:
The Data 2,3,4,9,10,11,15,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
The Data 2,3,4,9,10,11,15,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
The Data of 4,5,7,8,9,10,13,14,15,16,17,18,19,20,22,24,25,26,27,28,29,0,0,0,0,0,0,0,0,0,0,0,0

The second output:
Comparison method and the first method is consistent, just different output form, comparison line no matter how much the same, the same output only one set, not the same line don't output, the output of this kind of circumstance is:
The Data 2,3,4,9,10,11,15,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 5,6,7,9,10,13,18,19,20,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
The Data of 4,5,7,8,9,10,13,14,15,16,17,18,19,20,22,24,25,26,27,28,29,0,0,0,0,0,0,0,0,0,0,0,0
Requirements and instructions:
1, in the output should contain the DATA in front,
Number 2, each row number 33, not enough with the "0" is lacking; Output per order is growing up,
3, the key is two parts of program input data as much more than the previous example, each section might be best group, thousands or tens of thousands of group, 4, each row of the output shows how it contains a number next to it, such as digital, n=
5, to have the data input and output, and can save the output data,
6, when the data output can be selectively output, such as looking for the same output, the output contains only n=16, or line between n from 16 to 18, when no input constraints, is to find all have the same number of output,
7, both the output, the two procedures to do, also is to program 2,

CodePudding user response:

Excuse me, the input data is the data string, as shown above:
"The Data 2,3,4,9,10,11,15,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
"Or
"The Data 2,3,4,9,10,11,15,19
"Or an array (sorted by size)
Dim Data (7) as long
Data (0)=2
Data (1)=3
.
Or array (no)
Dim Data (7) as long
Data (0)=9
Data (1)=2
Data (2)=11
.


CodePudding user response:

 

Dim the Data () As String
Dim ArrFlag () As Single

Private Sub Command1_Click ()
Open "F: \ data. TXT" For Input As # 1


Dim Z As String
Dim the Count As Single

The Count=0
Do Until EOF (1)
The Line Input # 1, Z
ReDim Preserve Data (Count) As String
Data (Count)=Z
The Count=Count + 1
Loop
Close # 1

"' the above are retrieved

Analyse (Data)

Dim Arr () As String
Arr=GetData_1
For I=0 To UBound (Arr)
Print Arr (I)
Next
Print the
Print the
Arr=GetData_2
For I=0 To UBound (Arr)
Print Arr (I)
Next

End Sub


Private Sub Analyse (ByVal Data)
'Data analysisReDim ArrFlag (UBound (Data)) As Single
Dim I As Single

For I=0 To UBound (Data) - 1
If ArrFlag (I)=0 Then
For j=I + 1 To UBound (Data)
Then If ArrFlag (j)=0
If the Data (I)=Data (j) Then
ArrFlag (I)=1
ArrFlag (j)=2
End the If
End the If
Next
End the If
Next

End Sub


Private Function GetData_1 () As a String () 'output according to the first way, pay attention to the result without sorting
Dim the Count As Single
Dim m_Data () As String
The Count=0
For I=0 To UBound (ArrFlag)
If ArrFlag (I)=2 Then
ReDim Preserve m_Data (Count) As String
=Data m_Data (Count) (I)
The Count=Count + 1
End the If
Next
GetData_1=m_Data
End the Function


Private Function GetData_2 () As a String () 'by the second way output
Dim the Count As Single
Dim m_Data () As String
The Count=0
For I=0 To UBound (ArrFlag)
If ArrFlag (I)=1 Then
ReDim Preserve m_Data (Count) As String
=Data m_Data (Count) (I)
The Count=Count + 1
End the If
Next
GetData_2=m_Data
End the Function


CodePudding user response:

So trouble?
Lost in the database directly, a SQL statement not query out,

CodePudding user response:

reference vansoft reply: 3/f
so trouble?
Lost in the database directly, a SQL statement not query out,


Get a database, not more trouble

CodePudding user response:

Use a dictionary is better:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related