Anonymous user
Find the missing permutation: Difference between revisions
m
→{{header|PureBasic}}: Alternative
(two methods) |
m (→{{header|PureBasic}}: Alternative) |
||
Line 795:
EndDataSection</lang>
Based on the [[http://rosettacode.org/wiki/Permutations#PureBasic Permutations]] task the solution could be:
<lang PureBasic>If OpenConsole()
NewList a.s()
findPermutations(a(), "ABCD", 4)
ForEach a()
Select a()
Case "ABCD","CABD","ACDB","DACB","BCDA","ACBD","ADCB","CDAB","DABC"
Case "BCAD","CADB","CDBA","CBAD","ABDC","ADBC","BDCA","DCBA","BACD"
Case "BADC","BDAC","CBDA","DBCA","DCAB"
Default
PrintN(A()+" is missing.")
EndSelect
Next
Print(#CRLF$ + "Press ENTER to exit"): Input()
EndIf</lang>
=={{header|Python}}==
|