0

Problem 1a: Write a program that generate random text as follows:
the uses chooses a max number of words
it reads in a text file
chooses a random word
it prints the random word
it then finds the next instance of that word in the file
it selects the word following the word it just found
it prints this word
if find reaches the end of the document it starts at the beginning again.
The program will terminate if it loops all the way around and lands on the same place.
The program terminates if it generates the max number of words.

Problem 1b: Try the above but after generating the first two words, it must match
sequences of two words rather than just one.

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.