Home > Software engineering >  Turn the VB code errors
Turn the VB code errors

Time:11-03

Analysis of the double chromosphere sorted with the cold and hot number, but always test fails, seek expert advice, the code is as follows:
'==========================================================
'hot and cold sort
'==========================================================
'note: will each Pub_QS period before the issue of the winning number statistics number (not including the current), then press the hot and cold sort
'==========================================================
CpParam. Add "hot and cold periods," 20, "{10} {15} {20} {25} {30} {35}"
'users to set parametersThe Function Main
'===============declared or defined variable=============
CpRowCount=CpData. RowCount 'the lottery nper
CpColCount=CpData. ColCount 'Numbers number
CpMaxCode=CpData. MaxCode 'largest number
CpMinCode=CpData. MinCode 'minimum number
CpCodeCount=CpData. CodeCount 'number number



Pub_3Av=CpCodeCount/3 'trisection
Pub_QS=CInt (CpParam. Value (" hot and cold periods "))
'=================built table=================
CpAna. AddField "issue", 8
CpAna. AddField "Numbers", 20



For I=1 to CpCodeCount
CpAna. AddField I, 6
Next



CpAna. RowCount=CpRowCount + 1
CpAna. CreateTable ()




'==============algorithm subject============================
ReDim sum (CpCodeCount) 'Pub_QS within the term of the lottery number
ReDim SortCodes (CpCodeCount) after 'ordered by the sum of the lottery number sequence
ReDim Codes (CpColCount) 'the lottery data

For row=0 to CpRowCount
'the issue Numbers
If (row & lt; Then CpRowCount)
CpAna. Cell (row, "issue")=CpData. Seq (row)
CpAna. Cell (row, "Numbers").=CpData CodeStr (row)



For col=0 to CpColCount - 1
Codes (col)=CpData. Code (the row, col)
Next
End the If
'sort
Sort the sum SortCodes', according to the lottery number sequence number, SortCodes for ordering a good number sequence



For I=0 to CpCodeCount - 1
CpAna. Cell (row, 2 + I)=SortCodes (I)
Cl=CpColor. Neither too hot nor too cold Blue '
If (I + 1 & lt; Then Pub_3Av)
Cl=CpColor. Green 'cold
ElseIf I & gt; CpCodeCount - Pub_3AvThen
Cl=CpColor. Red hot
'End the If



If (row & lt; Then CpRowCount)
For col=0 to CpColCount - 1
IfCodes (col)=SortCodes (I) Then 'the winning Numbers in current
Cl=CpColor. Fuscia 'this number
The Exit For
End the If
Next
End the If



CpAna. Color (row, 2 + I)=cl
Next

If the row & gt;=Pub_QS Then
'Pub_QS period before the minus the lottery number
For col=0 to CpColCount - 1
I=CpData. Code (row - Pub_QS, col) - CpMinCode
The sum (I)=sum (I) - 1
Next
End the If

For col=0 to CpColCount - 1
I=Codes (col) - CpMinCode
The sum (I)=sum (I) + 1
Next
Next
End the Function



'==============auxiliary function============================
'according to the lottery number sequence number, Num to sort good number sequence
The Function Sort (ByVal Sum (), ByRef Num ())
CpMaxCode=CpData. MaxCode
CpMinCode=CpData. MinCode
CpCodeCount=CpData. CodeCount 'number number
ReDim aa (CpCodeCount)
For I=0 to CpCodeCount - 1
N=1
Min=99999
For j=0 to CpCodeCount - 1
If aa (j) & lt;> 1 And the Sum (j) & lt; Min Then
Min=Sum (j)
N=j
End the If
Next
Num (I)=CpMinCode + n
Aa (n)=1
Next
End the Function

CodePudding user response:

Where is wrong? Or upload the whole project, let everybody down, adjust the, of course, can not give points oh
  • Related