Post by lal7777 on Jul 14, 2010 0:13:09 GMT -5
1st of all i'm new here and this is my first post/thread.
2nd I'm working on a program that is fairly simple nevertheless i can't figure out what is going wrong with it.
The objective of the program are as follows:
- To cycle through all of the possible character
- To insert a new character next to the fully cycled other character
example:
(if you were only using the alphabet it would look like this)
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
aa
ab
ac
ad
ae
af
ag
ah
ai
aj
ak
al
am
an
ao
ap
aq
ar
as
at
au
av
aw
ax
ay
az
ba
bb
bc
bd
be
bf
bg
bh
bi
bj
bk
bl
bm
bn
bo
bp
bq
br
bs
bt
bu
bv
bw
bx
by
bz
.... Yea you probably get it by now... basically it'll end up poducing every possible word in the universe.
well here's the program ... if you can help please do so.
dim word as string 'the currrent word being created
dim char 'the current character being focused on
dim update 'tells the next character to be updated
while true
gosub cycle 'cycles through all the possible ascii characters
gosub update 'cycles through all the characters (in the word) -
'checking if they need to be updated
wend
cycle:
for char=0 to 127
if len(word) = 0 then
word = chr$(char)
else
word=left$(word,len(word)-1)+ chr$(char)
end if
cls
print word
next
'end
return
update:
update=0
for char=len(word) to 0 step -1
if update = 1 then
if char = 1 then
word=chr$(asc(0))+right$(word,len(word))
else
word = left$(word,char)+chr$(asc(mid$(word,char+1,1)+1)) + right$(word,char-2)
end if
update = 0
end if
if asc(mid$(word,char,1))>=127 then
word = left$(word,char)+chr$(asc(0)) + right$(word,(char - 2))
update = 1
end if
next
return
2nd I'm working on a program that is fairly simple nevertheless i can't figure out what is going wrong with it.
The objective of the program are as follows:
- To cycle through all of the possible character
- To insert a new character next to the fully cycled other character
example:
(if you were only using the alphabet it would look like this)
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
aa
ab
ac
ad
ae
af
ag
ah
ai
aj
ak
al
am
an
ao
ap
aq
ar
as
at
au
av
aw
ax
ay
az
ba
bb
bc
bd
be
bf
bg
bh
bi
bj
bk
bl
bm
bn
bo
bp
bq
br
bs
bt
bu
bv
bw
bx
by
bz
.... Yea you probably get it by now... basically it'll end up poducing every possible word in the universe.
well here's the program ... if you can help please do so.
dim word as string 'the currrent word being created
dim char 'the current character being focused on
dim update 'tells the next character to be updated
while true
gosub cycle 'cycles through all the possible ascii characters
gosub update 'cycles through all the characters (in the word) -
'checking if they need to be updated
wend
cycle:
for char=0 to 127
if len(word) = 0 then
word = chr$(char)
else
word=left$(word,len(word)-1)+ chr$(char)
end if
cls
print word
next
'end
return
update:
update=0
for char=len(word) to 0 step -1
if update = 1 then
if char = 1 then
word=chr$(asc(0))+right$(word,len(word))
else
word = left$(word,char)+chr$(asc(mid$(word,char+1,1)+1)) + right$(word,char-2)
end if
update = 0
end if
if asc(mid$(word,char,1))>=127 then
word = left$(word,char)+chr$(asc(0)) + right$(word,(char - 2))
update = 1
end if
next
return