Qbasicnews.com

General => General Programming => Topic started by: lrcvs on August 20, 2009, 12:36:41 PM



Title: 'Program to generate "sentences" random
Post by: lrcvs on August 20, 2009, 12:36:41 PM
'Program to generate "sentences" random
'lrcvs 20.08.09

'Possible uses:
'to sort files
'fill arrays....


CLS
FOR h = 1 TO 10 'Number of sentences
l = 10 'Number of words
j = 0
WHILE j < l
z$ = ""
RANDOMIZE TIMER
a = INT(RND * 100)
IF a > 64 THEN b = a
IF b < 91 THEN c = b
IF a > 64 AND b < 91 THEN z$ = CHR$(b): y$ = z$
FOR n = 1 TO 10
RANDOMIZE TIMER
a = INT(RND * 100)
IF a > 64 THEN b = a
IF b < 91 THEN c = b
IF a > 64 AND b < 91 THEN z$ = z$ + CHR$(b)
NEXT n
k$ = k$ + z$ + " "
j = j + 1
IF LEFT$(k$, 1) = " " THEN MID$(k$, 1) = y$
WEND
PRINT k$
k$ = ""
NEXT h
END