Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List All Combinations
#11
WHITETIGER,

I don't recognize my original idea in your code, but nevertheless CONGRATULATIONS! It works perfectly given any string of characters and length.

We're going to have to get Progger to grade the winners.
*****
Reply
#12
Code:
FOR z = 1 TO l
  IF INSTR(s$, LTRIM$(STR$(z))) < 1 THEN EXIT FOR
  f$ = ""
  IF z = l THEN
   FOR z2 = 1 TO l
    f$ = f$ + MID$(in$, VAL(MID$(s$, z2, 1)), 1)
   NEXT z2
   PRINT f$
  END IF
NEXT z
this is it.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#13
Code:
DECLARE SUB PrintCombos (Lead$, Text$)

INPUT "Enter string: ", Text$
CALL PrintCombos("", Text$)

SUB PrintCombos (Lead$, Text$)
IF LEN(Text$) > 1 THEN
     FOR CurrentLetter% = 1 TO LEN(Text$)
          NewLead$ = Lead$ + MID$(Text$, CurrentLetter%, 1)
          NewText$ = LEFT$(Text$, CurrentLetter% - 1) + RIGHT$(Text$, LEN(Text$) - CurrentLetter%)
          CALL PrintCombos(NewLead$, NewText$)
     NEXT CurrentLetter%
ELSE
     PRINT Lead$ + Text$
END IF
END SUB

*peace*

Meg.

i didn't bother getting it to read from DATA and write to a file. those changes could be made easily.
Reply
#14
MEG,

I tested your program, and it works 100%. Beautiful job! Nice and simple too. Where were you when we needed you?

P.S. Are you sure you don't have Spanish blood? Your solution is recursive like Antoni's and Nathan's.
*****
Reply
#15
Meg:
It is very simple , in addition it works... Big Grin
Good work!
Where were you when I started the recursion challenge?
Antoni
Reply
#16
I'm sure that I *do* have Spanish blood Smile My father's mother's entire family lives in Puerto Rico. (I think I end up roughly 1/4 puertorican, 1/4 scottish, 1/4 english, 1/4 italian).

*peace*

Meg.
Reply
#17
I am 1/4 spanish. But I don't use recursion that much. ;*( Arrrrgghhhh!!!!

Maybe this chinese bloodline my mom has offsetted my recusive abilities.

;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#18
Quote:I am 1/4 spanish. But I don't use recursion that much. ;*( Arrrrgghhhh!!!!

Maybe this chinese bloodline my mom has offsetted my recusive abilities.

;*)
I bet you just use it 25% of the time :rotfl:
In a world without walls and doors, who needs Windows and Gates?
Reply
#19
they're all good :o

<-----reconsiders his opinions on recursion, which he avoids like GOTO
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#20
Quote:they're all good :o

<-----reconsiders his opinions on recursion, which he avoids like GOTO

Recursion and goto has there uses. So don't avoid them like you do with Japanese Encephalitis. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)