求助一个小编程(继续求教版主)
一组数1,2,3,4,5,6,7用for endfor编程实现取6个数(不重复)为一条记录(共有7条记录),此程序如何编写?谢谢!
[此贴子已经被作者于2016-8-15 11:22编辑过]
CREATE CURSOR T1 (X C(1)) FOR I=1 TO 7 INSERT INTO T1 VALUES (STR(I,1)) ENDFOR SELECT A1.X+A2.X+A3.X+A4.X+A5.X+A6.X X FROM T1 A1 ; INNER JOIN T1 A2 ON A2.X>A1.X ; INNER JOIN T1 A3 ON A3.X>A2.X ; INNER JOIN T1 A4 ON A4.X>A3.X ; INNER JOIN T1 A5 ON A5.X>A4.X ; INNER JOIN T1 A6 ON A6.X>A5.X
[此贴子已经被作者于2016-8-15 11:54编辑过]
CREATE CURSOR T1 (X N(2)) Dimension szpt(7) szpt(1)='3' szpt(2)='6' szpt(3)='13' szpt(4)='14' szpt(5)='18' szpt(6)='23' szpt(7)='32' FOR I=1 TO 7 INSERT INTO T1 VALUES (VAL(szpt[I])) ENDFOR SELECT A1.X A1,A2.X A2,A3.X A3,A4.X A4,A5.X A5,A6.X A6 FROM T1 A1 ; INNER JOIN T1 A2 ON A2.X>A1.X ; INNER JOIN T1 A3 ON A3.X>A2.X ; INNER JOIN T1 A4 ON A4.X>A3.X ; INNER JOIN T1 A5 ON A5.X>A4.X ; INNER JOIN T1 A6 ON A6.X>A5.X INTO DBF FC\SZPT BROWSE
Create CURSOR szpt (a1 N(3),a2 N(3),a3 N(3),a4 N(4),a5 N(4),a6 N(4)) Dimension szpt(7) szpt(1)= 3 szpt(2)= 6 szpt(3)= 13 szpt(4)= 14 szpt(5)= 18 szpt(6)= 23 szpt(7)= 32 FOR ln1 = 1 TO 2 lc1 = szpt[ln1] FOR ln2 = 2 TO 3 lc2 = szpt[ln2] FOR ln3 = 3 TO 4 lc3 = szpt[ln3] FOR ln4 = 4 TO 5 lc4 = szpt[ln4] FOR ln5 = 5 TO 6 lc5 = szpt[ln5] FOR ln6 = 6 TO 7 lc6 = szpt[ln6] IF ln1 < ln2 AND ln2 < ln3 AND ln3 < ln4 AND ln4 < ln5 AND ln5 < ln6 INSERT INTO szpt VALUES (lc1, lc2, lc3, lc4, lc5, lc6) ENDIF ENDFOR ENDFOR ENDFOR ENDFOR ENDFOR ENDFOR BROWSE