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 randomnumber 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 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 prepositionto "from", "over", "under", on;
Sample InputOutput
Enter a seed Value:
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:
for Test Case Performance
for Pseudo Code clarity
for the use of Meaningful Variable Names
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 prepositionto "from", "over", "under", on;
string sentence ; completed sentence
int seed;
cout "Enter a seed Value: ;
cin seed;
srandseed;
create sentences
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
