Question: C++ Programming 3-7. Write a program that will use random number generation to create sentences. Use the following four arrays to pick a word at
C++ Programming
3-7. Write a program that will use random number generation to create sentences. Use the following four arrays to pick a word at random to form a grammatically correct sentence. The sentence will begin with an uppercase letter and end in a period. Use the following order from the following arrays: article, noun, verb, preposition, article, and noun.
article - "the", "a", "one", "some", "any"
noun - "boy", "girl", "dog", "town", "car"
verb - "drove", "jumped", "ran", "walked", "skipped"
preposition - "to", "from", "over", "under", "on"
The program is started below, fill in the for loop.
#include
#include
#include
#include
#include
using namespace std;
void main() {
char article[5][5] = {"the", "a", "one", "some", "any"};
char noun[5][5] = {"boy", "girl", "dog", "town", "car"};
char verb[5][8] = {"drove", "jumped", "ran", "walked", "skipped"};
char preposition[5][6] = {"to", "from", "over", "under", "on"};
char sent[36];
int i;
srand(time(NULL));
for (i = 1; i <= 10; i++) {
/* use cstring functions to copy a random initial article, then use cstring functions to cat the other words onto the end of the sentence (in the above order). Also cat spaces between words and a period at the end of the sentence, along with making sure just the first letter of the sentence is uppercase. */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
