我说呢,这下就完全可以了,可以算出准确的值了,呵呵!具体如下面:是按照 (
X,Y,计算结果)的形式来排列的,每一组值之间用空格分开了。总共有18组值符合条件,
误差均在(+1)之内。下面的值都是符合误差在1的范围内的。可能是小于最终值,误差在1之内,即为负差:-1,也可能是大于最终值,误差误差在1之内,即正差:+1,下面这些值得是符合要求的。
5,3340,609526.62 66,3213,609526.134 127,3086,609525.648 359,2603,609526.782 420,2476,609526.296
481,2349,609525.81 542,2222,609525.324 713,1866,609526.944 774,1739,609526.458 835,1612,609525.972
896,1485,609525.486 1067,1129,609527.106 1128,1002,609526.62 1189,875,609526.134 1250,748,609525.648
1482,265,609526.782 1543,138,609526.296 1604,11,609525.81
算法修改如下:
Private Sub Command1_Click()
Dim lngI As Long
Dim lngJ As Long
Dim lngK As Long
Dim lngM As Long
Dim SUM As Double
Dim blnHaveResults As Boolean
Dim arySUM(1000, 2)
For lngI = -1 To 1608
For lngJ = -1 To 3345
SUM = lngI * 378.756 + lngJ * 181.926
If ((SUM >= 609525.24) And (SUM <= 609526.24)) Or ((SUM > 609526.24) And (SUM <= 609527.24)) Then
blnHaveResults = True
arySUM(lngK, 0) = lngI
arySUM(lngK, 1) = lngJ
arySUM(lngK, 2) = SUM
Text1.Text = Text1.Text & arySUM(lngK, 0) & "," & arySUM(lngK, 1) & "," & arySUM(lngK, 2) & " "
lngK = lngK + 1
lngM = lngM + 1
If lngM = 5 Then
Text1.Text = Text1.Text & vbCrLf
lngM = 0
End If
End If
Next lngJ
Next lngI
If blnHaveResults <> True Then
MsgBox "No Value"
End If
End Sub
[此贴子已经被作者于2007-2-5 12:02:57编辑过]