C.I.S. 1.5

Brooklyn College

Professor Langsam

Assignment #6

Write a C++ program that uses random number generation to
create sentences. The program should use four arrays of string called article,
noun, verb and preposition.
The program should create a sentence by selecting a word at random from each
array in the following order:

article, noun, verb, preposition, article,
noun

As each word is picked, it should be printed separated by a
single blank from the previous word. Each sentence should start with a capital
letter and end with a period. You program should generate a paragraph of twenty
sentences.

The arrays should be filled from four text files which
contain the following words:

Article.txt        Noun.txt      Verb.txt      Preposition.txt

the                boy           drove         to

a                  girl          jumped        from

one                dog           ran           over

some               town          walked        under

any                car           skipped       on

toy           played

chair

As you place each word into the appropriate array, maintain a
counter of the number of words of each type and use that counter together with
the random number generator to choose a word for your sentences.

After the preceding program is written and working add ten
additional words of your choosing to each text file and have your program
generate a short story consisting of 2 paragraphs of 5 sentences each. (How
about the possibility of a random term paper writer?)

Submit your program, a copy of the four text files and your
results. Be sure to use the structured programming techniques we have learned
in class. Do not use external variables (with the exception of file variables),
unless you are prepared to justify their necessity. Use meaningful variables
and comment each function.