修改后的程序如下,共384组。仅供参考
*有四组数,每组有二个数字,每组取一个数,把它们组合成四位数,总共能组成多少组四位数,并显示出来。
CREATE DBF LB (A1 C(4)) &&建立表
FOR X=1234 TO 8765
Y=STR(X,4)
*去除0,9
IF '0'$Y .OR. '9'$Y
LOOP
ENDIF
*去除重复
IF OCCURS('1',Y)>1 .OR. OCCURS('2',Y)>1 .OR. OCCURS('3',Y)>1 .OR. OCCURS('4',Y)>1 .OR. OCCURS('5',Y)>1 .OR. OCCURS('6',Y)>1 .OR. OCCURS('7',Y)>1 .OR. OCCURS('8',Y)>1
LOOP
ENDIF
*每组取一个数
IF ('1'$Y .AND. '2'$Y) .OR. ('3'$Y .AND. '4'$Y) .OR. ('5'$Y .AND. '6'$Y) .OR. ('7'$Y .AND. '8'$Y)
LOOP
ENDIF
APPEND BLANK
REPLACE A1 WITH Y
REPLACE A1 WITH STRTRAN(A1,'1','A')
REPLACE A1 WITH STRTRAN(A1,'2','B')
REPLACE A1 WITH STRTRAN(A1,'3','C')
REPLACE A1 WITH STRTRAN(A1,'4','D')
REPLACE A1 WITH STRTRAN(A1,'5','E')
REPLACE A1 WITH STRTRAN(A1,'6','F')
REPLACE A1 WITH STRTRAN(A1,'7','G')
REPLACE A1 WITH STRTRAN(A1,'8','H')
ENDFOR
BROWSE