大侠,太佩服了,看来代码不是重在写,是重在考虑
我看看自己的,把错的地方改了,可是还是不对,请大家帮我看看
SET TALK OFF
CLEAR ALL
lncounter=0
FOR start=0 TO 9999
lcNumber=SUBSTR(ALLTRIM(STR(start)),1,4)
lnLength=Len(lcNumber)
DO CASE
CASE lnlength=1 OR lnLength=2
IF "1"$lcNumber OR "4"$lcNumber OR "7"$lcNumber
??lcnumber+" "
lncounter=lncounter+1
ENDIF
CASE lnLength=3
IF "1"$lcNumber OR "4"$lcNumber OR "7"$lcNumber
lcNumOne=SUBSTR(lcNumber,1,1)
lcNumTwo=SUBSTR(lcNumber,2,1)
lcNumThr=SUBSTR(lcNumber,3,1)
lnSum1=VAL(lcNumOne)+VAL(lcNumTwo)
lnSum2=VAL(lcNumOne)+VAL(lcNumThr)
lnSum3=VAL(lcNumThr)+VAL(lcNumTwo)
DO CASE
Case lnSum1=10 OR lnSum1=16 OR lnSum1=18 OR lnsum1=6 OR lnsum1=8
??lcnumber+" "
lncounter=lncounter+1
CASE lnSum2=10 OR lnSum2=16 OR lnSum2=18 OR lnsum2=6 OR lnsum2=8
??lcnumber+" "
lncounter=lncounter+1
CASE lnSum3=10 OR lnSum3=16 OR lnSum3=18 OR lnsum3=6 OR lnsum3=8
??lcnumber+" "
lncounter=lncounter+1
CASE lcNumOne="0" OR lcNumTwo="0" OR lcNumThr="0"
??lcnumber+" "
lncounter=lncounter+1
ENDCASE
ENDIF
CASE lnLength=4
IF "1"$lcNumber OR "4"$lcNumber OR "7"$lcNumber
lcNumOne=SUBSTR(lcNumber,1,1)
lcNumTwo=SUBSTR(lcNumber,2,1)
lcNumThr=SUBSTR(lcNumber,3,1)
lcNumFou=SUBSTR(lcNumber,4,1)
lnSum1=VAL(lcNumOne)+VAL(lcNumTwo)
lnSum2=VAL(lcNumOne)+VAL(lcNumThr)
lnSum3=VAL(lcNumThr)+VAL(lcNumTwo)
lnSum4=VAL(lcNumThr)+VAL(lcNumFou)
lnSum5=VAL(lcNumTwo)+VAL(lcNumFou)
lnSum6=VAL(lcNumOne)+VAL(lcNumFou)
DO CASE
Case lnSum1=10 OR lnSum1=16 OR lnSum1=18 OR lnsum1=0 OR lnsum1=6 OR lnsum1=8
??lcnumber+" "
lncounter=lncounter+1
CASE lnSum2=10 OR lnSum2=16 OR lnSum2=18 OR lnsum2=0 OR lnsum2=6 OR lnsum2=8
??lcnumber+" "
lncounter=lncounter+1
CASE lnSum3=10 OR lnSum3=16 OR lnSum3=18 OR lnsum3=0 OR lnsum3=6 OR lnsum3=8
??lcnumber+" "
lncounter=lncounter+1
CASE lnSum4=10 OR lnSum4=16 OR lnSum4=18 OR lnsum4=0 OR lnsum4=6 OR lnsum4=8
??lcnumber+" "
lncounter=lncounter+1
CASE lnSum5=10 OR lnSum5=16 OR lnSum5=18 OR lnsum5=0 OR lnsum5=6 OR lnsum5=8
??lcnumber+" "
lncounter=lncounter+1
CASE lnSum6=10 OR lnSum6=16 OR lnSum6=18 OR lnsum6=0 OR lnsum6=6 OR lnsum6=8
??lcnumber+" "
lncounter=lncounter+1
ENDCASE
ENDIF
ENDCASE
ENDFOR
??"共计有("+TRANSFORM(lncounter)+")个"
SET TALK ON