tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
25
Task/Permutations/Run-BASIC/permutations.run
Normal file
25
Task/Permutations/Run-BASIC/permutations.run
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
list$ = "h,e,l,l,o" ' supply list seperated with comma's
|
||||
|
||||
while word$(list$,d+1,",") <> "" 'Count how many in the list
|
||||
d = d + 1
|
||||
wend
|
||||
|
||||
dim theList$(d) ' place list in array
|
||||
for i = 1 to d
|
||||
theList$(i) = word$(list$,i,",")
|
||||
next i
|
||||
|
||||
for i = 1 to d ' print the Permutations
|
||||
for j = 2 to d
|
||||
perm$ = ""
|
||||
for k = 1 to d
|
||||
perm$ = perm$ + theList$(k)
|
||||
next k
|
||||
if instr(perms$,perm$+",") = 0 then print perm$ ' only list 1 time
|
||||
perms$ = perms$ + perm$ + ","
|
||||
h$ = theList$(j)
|
||||
theList$(j) = theList$(j - 1)
|
||||
theList$(j-1) = h$
|
||||
next j
|
||||
next i
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue