Question: Write a program that uses random - number generation to create sentences. The program should use four array of strings called article, noun, verb and

Write a program that uses random-number generation to create sentences. The program should use four array of strings 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 and noun. As each word is picked it should be concantenated to the previous words to make a
sentence, separated by spaces. When final sentence is output it should start with a capital letter and end with a period. The program should
generate 8 sentences.
The arrays are:
string article[={ "the", "a", "one", "some", "any" };
string noun[]={ "boy", "girl", "dog", "town", "car" };
string verb[]={ "drove", "jumped", "ran", "walked", "skipped" };
string preposition[]={"to", "from", "over", "under", "on"};
Sample Input/Output
Enter a seed Value: 3
Any boy ran on any town.
Any boy ran under one car.
Any girl skipped to one town.
Any boy ran from one dog.
One boy jumped over one dog.
A boy ran over one girl.
One boy walked to one girl.
Any girl walked from any dog.
Below is the Lab Score breakdown:
70% for Test Case Performance
10% for Pseudo Code clarity
10% for the use of Meaningful Variable Names
10% for Formatting, Indentation & Coding Style
Template for the code:
#include
#include
#include
#include
using namespace std;
int main()
{
string article[]={ "the", "a", "one", "some", "any" };
string noun[]={ "boy", "girl", "dog", "town", "car" };
string verb[]={ "drove", "jumped", "ran", "walked", "skipped" };
string preposition[]={"to", "from", "over", "under", "on"};
string sentence =""; // completed sentence
int seed;
cout "Enter a seed Value: ";
cin >> seed;
srand(seed);
// create 8 sentences
}
Write a program that uses random - number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!