Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
DIMENSION xx(4)
FOR x=1 TO 4
xx(x)=CHR(x+64)
ENDFOR
FOR a=1 TO 4
FOR c=1 TO 4
?? xx(c)
ENDFOR
?
FOR b=1 TO 3
cc=xx(b)
xx(b)=xx(b+1)
xx(b+1)=cc
FOR c=1 TO 4
?? xx(c)
ENDFOR
?
cc=xx(b)
xx(b)=xx(b+1)
xx(b+1)=cc
ENDFOR
?
cc=xx(1)
FOR x=1 TO 3
xx(x)=xx(x+1)
ENDFOR
xx(4)=cc
ENDFOR
USE classes_to_take IN 1 ORDER class_code
USE class_rooms IN 2 ORDER class_code
CREATE CURSOR temp (cl1 c(5), cl2 c(5), cl3 c(5), cl4(c5), cl5 c(5), cl6 c(5), cl7(c5), cl8 c(5), cl9 c(5), cl10 c(5))
DIMENSION xx(10)
SELECT 1
xx=1
SCAN FOR EOF()=.f.
xx(x)=classes_to_take.class_code
xx=xx+1
ENDFOR
SELECT temp
FOR a=1 TO 10
INSERT INTO temp VALUES (xx(1), xx(2), xx(3), xx(4), xx(5), xx(6), xx(7), xx(8), xx(9), xx(10))
FOR b=1 TO 3
cc=xx(b)
xx(b)=xx(b+1)
xx(b+1)=cc
FOR c=1 TO 4
INSERT INTO temp VALUES (xx(1), xx(2), xx(3), xx(4), xx(5), xx(6), xx(7), xx(8), xx(9), xx(10))
ENDFOR
cc=xx(b)
xx(b)=xx(b+1)
xx(b+1)=cc
ENDFOR
cc=xx(1)
FOR x=1 TO 3
xx(x)=xx(x+1)
ENDFOR
xx(4)=cc
ENDFOR
_done=.t.
SCAN FOR EOF()=.f.
SELECT class_rooms
FOR x=1 TO 10
a='seek cl'+ALLTRIM(STR(x,2,0))
&a
IF !FOUND()
_done=.f.
EXIT
ENDIF
ENDFOR
IF _done=.t.
EXIT
ELSE
_done=.t.
ENDIF
ENDSCAN
SELECT temp
FOR a=1 TO 10
INSERT INTO temp VALUES (xx(1), xx(2), xx(3), xx(4), xx(5), xx(6), xx(7), xx(8), xx(9), xx(10))
FOR b=1 TO 9
cc=xx(b)
xx(b)=xx(b+1)
xx(b+1)=cc
FOR c=1 TO 9
INSERT INTO temp VALUES (cc(1), cc(2), cc(3), cc(4), cc(5), cc(6), cc(7), cc(8), cc(9), cc(10))
ENDFOR
cc=xx(b)
xx(b)=xx(b+1)
xx(b+1)=cc
ENDFOR
cc=xx(1)
FOR x=1 TO 9
xx(x)=xx(x+1)
ENDFOR
xx(10)=cc
ENDFOR
DIMENSION aryGroup(4)
aryGroup(1) = [a]
aryGroup(2) = [b]
aryGroup(3) = [c]
aryGroup(4) = [d]
CLEAR
?[Set of 4 Size 1 (4_P_1)]
?REPLICATE([-], 34)
GetPermutations(1,@aryGroup)
?
?
?[Set of 4 Size 2 (4_P_2)]
?REPLICATE([-], 34)
GetPermutations(2,@aryGroup)
?
?
?[Set of 4 Size 4 (4_P_4)]
?REPLICATE([-], 34)
GetPermutations(4,@aryGroup)
PROCEDURE GetPermutations(tcSize, tcSet)
LOCAL lnMembers, lnCounter, lnTemp, lnTemp2
lnMembers = ALEN(tcSet)
DIMENSION aryIndice(lnMembers)
aryIndice = -1
DO WHILE .T.
IF(aryIndice(1) < 0)
lnCounter = 1
DO WHILE lnCounter < lnMembers + 1
aryIndice(lnCounter) = lnCounter - 1
lnCounter = lnCounter + 1 && was above
ENDDO
lnBeginning = tcSize +1
lnEnd = lnMembers
DO WHILE lnBeginning < lnEnd
lnTemp2 = aryIndice(lnBeginning)
aryIndice(lnBeginning) = aryIndice(lnEnd)
lnBeginning = lnBeginning + 1
aryIndice(lnEnd) = lnTemp2
lnEnd = lnEnd - 1
ENDDO
?LEFT(DisplayString(lnMembers, @tcSet, @aryIndice), tcSize)
LOOP
ELSE
lnCounter = lnMembers - 1
DO WHILE lnCounter >= 1 AND aryIndice(lnCounter) >= aryIndice(lnCounter + 1)
lnCounter = lnCounter - 1
ENDDO
IF(lnCounter < 1)
EXIT
ELSE
lnLeast = lnCounter + 1
lnTemp = lnCounter + 2
DO WHILE lnTemp < lnMembers + 1
IF(aryIndice(lnTemp) < aryIndice(lnLeast) AND aryIndice(lnTemp) > aryIndice(lnCounter))
lnLeast = lnTemp
ENDIF
lnTemp = lnTemp + 1 && was above
ENDDO
lnTemp2 = aryIndice(lnCounter)
aryIndice(lnCounter) = aryIndice(lnLeast)
aryIndice(lnLeast) = lnTemp2
IF (tcSize > lnCounter)
lnBeginning = lnCounter + 1
lnEnd = lnMembers
DO WHILE lnBeginning < lnEnd
lnTemp2 = aryIndice(lnBeginning)
aryIndice(lnBeginning) = aryIndice(lnEnd)
lnBeginning = lnBeginning + 1
aryIndice(lnEnd) = lnTemp2
lnEnd = lnEnd - 1
ENDDO
lnBeginning = tcSize + 1
lnEnd = lnMembers
DO WHILE lnBeginning < lnEnd
lnTemp2 = aryIndice(lnBeginning)
aryIndice(lnBeginning) = aryIndice(lnEnd)
lnBeginning = lnBeginning + 1
aryIndice(lnEnd) = lnTemp2
lnEnd = lnEnd - 1
ENDDO
ENDIF
?LEFT(DisplayString(lnMembers, @tcSet, @aryIndice), tcSize)
LOOP
ENDIF
ENDIF
ENDDO
ENDPROC
FUNCTION DisplayString(tcMembers, tcSet, tcIndice)
LOCAL lnCounter, lcString
lcString = []
FOR lnCounter = 1 TO tcMembers
IF (tcIndice(lnCounter) + 1) != 0
lcString = lcString + TRANSFORM(tcSet(tcIndice(lnCounter)+1))
ENDIF
ENDFOR
RETURN ALLTRIM(lcString)
ENDFUNC
DIMENSION aryGroup(4)
aryGroup(1) = [a]
aryGroup(2) = [b]
aryGroup(3) = [c]
aryGroup(4) = [d]
CLEAR
?[Set of 4 Choose 1 (4_C_1)]
?REPLICATE([-], 34)
GetCombinations(2,@aryGroup)
?
?
?[Set of 4 Choose 2 (4_C_2)]
?REPLICATE([-], 34)
GetCombinations(2,@aryGroup)
?
?
?[Set of 4 Choose 3 (4_C_3)]
?REPLICATE([-], 34)
GetCombinations(3,@aryGroup)
?
?
?[Set of 4 Choose 4 (4_C_4)]
?REPLICATE([-], 34)
GetCombinations(4,@aryGroup)
PROCEDURE GetCombinations(tcSize, tcSet)
LOCAL lnMembers, lnCounter, lnTemp
lnMembers = ALEN(tcSet)
DIMENSION aryIndice(lnMembers)
aryIndice = 0
DO WHILE .T.
IF aryIndice(1) < 1
lnCounter = 1
FOR lnCounter = 1 TO tcSize
aryIndice(lnCounter) = lnCounter
ENDFOR
?DisplayString(lnMembers, @tcSet, @aryIndice)
LOOP
ELSE
lnCounter = tcSize &&- 1
DO WHILE lnCounter >= 1 AND aryIndice(lnCounter) >= (lnMembers - tcSize + lnCounter)
lnCounter = lnCounter - 1
ENDDO
IF(lnCounter >= 1)
aryIndice(lnCounter) = aryIndice(lnCounter) + 1
lnTemp = lnCounter
DO WHILE lnTemp < tcSize
lnTemp = lnTemp + 1
aryIndice(lnTemp) = aryIndice(lnTemp-1) + 1
ENDDO
?DisplayString(lnMembers, @tcSet, @aryIndice)
LOOP
ELSE
EXIT
ENDIF
ENDIF
ENDDO
ENDPROC
FUNCTION DisplayString(tcMembers, tcSet, tcIndice)
LOCAL lnCounter, lcString
lcString = []
FOR lnCounter = 1 TO tcMembers
IF tcIndice(lnCounter) != 0
lcString = lcString + TRANSFORM(tcSet(tcIndice(lnCounter)))
ENDIF
ENDFOR
RETURN ALLTRIM(lcString)
ENDFUNC
LOCAL lnI, lnI2, lnVar,lnN,lcWoord,lcNwrd,lcN,lnVrgt,lcNsolo
STORE 0 TO lnVar,lnVrgt
STORE " " TO lcWoord, lcNwrd, lcNsolo
RELEASE MyArray*
WITH ThisForm
lnVar = LEN(ALLTRIM(LOWE(.cWoord.Value)))
lcWoord = ALLTRIM(LOWE(.cWoord.Value))
FOR lnI = 1 TO lnVar
lcN = SUBS(lcWoord,lnI,1)
DO CASE
CASE lcN = "?"
lcN = ""
lnVrgt = lnVrgt+1
ENDC
lcNwrd = lcNwrd+lcN
ENDFOR
lcNwrd = ALLTRIM(lcNwrd)
lnN = LEN(lcNwrd)+lnVrgt
FOR lnI2 = 1 TO lnN
IF OCCU(SUBS(lcNwrd,lnI2,1),lcNsolo)<1
lcNsolo=lcNsolo+SUBS(lcNwrd,i,1)
ENDI
ENDFOR
ENDWITH
SELECT woord FROM nederlands WHERE MyUDF(TRIM(compwoord),lcNwrd,lnVar,lcNsolo) ;
AND DELETED()=.F. INTO ARRAY.myArray
FUNCTION MyUDF
PARA tcField,tcPattern,tnLength,tcSolo
LOCAL lnI, lnI2
DO CASE
CASE "?" $ tcPattern
FOR lnI = 1 TO LEN(tcSolo)
DO CASE
CASE OCCU(SUBS(tcSolo,lnI,1),tcField) < OCCU(SUBS(tcSolo,lnI,1),tcPattern)
RETU .F.
ENDC
ENDFOR
CASE LEN(tcField) # tnLength
RETU .F.
OTHE
FOR lnI2 = 1 TO LEN(tcSolo) &&10
DO CASE
CASE OCCU(SUBS(tcSolo,lnI2,1),tcField) # OCCU(SUBS(tcSolo,lnI2,1),tcPattern)
RETU .F.
ENDC
ENDFOR
ENDC
cString = "ABCD"
tempString = cString
DO WHILE .T.
? tempString
DO ex3
? tempString
DO ex2
? tempString
DO ex3
? tempString
DO ex2
? tempString
DO ex3
? tempString
DO ex1
IF tempString == cString
EXIT
ENDIF
? tempString
ENDDO
PROCEDURE ex3
tempString = LEFT(tempString,2) + ;
RIGHT(tempString,1) + ;
SUBSTR(tempString,3,1)
ENDPROC
PROCEDURE ex2
tempString = LEFT(tempString,1) + ;
SUBSTR(tempString,3,1) + ;
SUBSTR(tempString,2,1) + ;
RIGHT(tempString,1)
ENDPROC
PROCEDURE ex1
tempString = SUBSTR(tempString,2,1) + ;
SUBSTR(tempString,1,1) + ;
SUBSTR(tempString,4,1) + ;
SUBSTR(tempString,3,1)
ENDPROC