Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question
#1
i need a prog to make this

Code:
A
AA
AAA
B
BA
BAA
C
CA
CAA
...
Z
ZA
ZAA
AB
ABA
BB
BBA
CB
CBA
...
hope thatr helps
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#2
You mean like this?
Code:
DEFINT A-Z

' One letter:
FOR a1 = ASC("A") TO ASC("Z")
   PRINT CHR$(a1)
NEXT a1

' Two letters:
FOR a1 = ASC("A") TO ASC("Z")
   FOR a2 = ASC("A") TO ASC("Z")
      PRINT CHR$(a1) + CHR$(a2)
   NEXT a2
NEXT a1

' Three letters:
FOR a1 = ASC("A") TO ASC("Z")
   FOR a2 = ASC("A") TO ASC("Z")
      FOR a3 = ASC("A") TO ASC("Z")
         PRINT CHR$(a1) + CHR$(a2) + CHR$(a3)
      NEXT a3
   NEXT a2
NEXT a1
Reply
#3
close. very very close. it doesn't do spaces like "AA " or "B "
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#4
Do you want a space after each one, or just the ones that are less than 3 letters?
Reply
#5
just the ones less than 3 like

Code:
A  
B  
...
AA
BA
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#6
you trying to crack some thing?
Reply
#7
Ok, how's this?
Code:
DEFINT A-Z

' One letter:
FOR a1 = ASC("A") TO ASC("Z")
   PRINT CHR$(a1) + "  "
NEXT a1

' Two letters:
FOR a1 = ASC("A") TO ASC("Z")
   FOR a2 = ASC("A") TO ASC("Z")
      PRINT CHR$(a1) + CHR$(a2) + " "
   NEXT a2
NEXT a1

' Three letters:
FOR a1 = ASC("A") TO ASC("Z")
   FOR a2 = ASC("A") TO ASC("Z")
      FOR a3 = ASC("A") TO ASC("Z")
         PRINT CHR$(a1) + CHR$(a2) + CHR$(a3)
      NEXT a3
   NEXT a2
NEXT a1
Reply
#8
yea thanks. 8) that should do if i have another question ill just post again.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#9
I don't know if you settled on the previous answer or not, but here's another way to do it:

CLS : DIM PZ$(26)

GOSUB LOADER
P1 = 1: N = 1: R = 2: C = 1: RMAX = R + 3
RMIN = R: PT = 16

SHOWIT:
DO WHILE N < 4
LOCATE R, C: PRINT PZ$(P1);
IF N >= 2 THEN PRINT "A"; ELSE
IF N = 3 THEN PRINT "A" ELSE
R = R + 1: N = N + 1
IF R >= RMAX THEN R = RMIN: C = C + 5 ELSE
LOOP
P1 = P1 + 1: N = 1
IF P1 <= PT THEN GOTO SHOWIT ELSE
IF PT = 26 THEN GOTO LOAD2 ELSE
PT = 26: RMIN = R + 4: R = RMIN: RMAX = R + 3: C = 1
GOTO SHOWIT

LOAD2:
GOSUB LOADER
P = 1: N = 1: R = 10: C = 1: RMAX = R + 2
RMIN = R: PT = 16

SHOWIT2:
DO WHILE N < 3
LOCATE R, C: PRINT PZ$(P); PZ$(2);
IF N = 2 THEN PRINT "A" ': P = T: PRINT PZ$(P); PZ$(T);
R = R + 1: N = N + 1
IF R >= RMAX THEN R = RMIN: C = C + 5 ELSE
LOOP
P = P + 1: N = 1
IF P <= PT THEN GOTO SHOWIT2 ELSE
IF PT = 26 THEN GOTO QUIT ELSE
PT = 26: RMIN = R + 4: R = RMIN: RMAX = R + 2: C = 1
GOTO SHOWIT2
END

QUIT:
END

LOADER:
RESTORE
FOR PZ = 1 TO 26
READ PZ$(PZ): NEXT
RETURN

DATA A,B,C,D,E,F,G,H,I,J,K,L,M
DATA N,O,P,Q,R,S,T,U,V,W,X,Y,Z

As you can see it's fairly simple and compact.
adsherm
Reply
#10
your prog doesn't show all the combinations.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)