0

Random number generator program

"Write a program that uses random number generation to create sentences. Use four arrays of strings called article, noun, verb and preposition. 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, concatenate it to the previous words in the sentence. The words should be separated by spaces. When the final sentence is output, it should start with a capital letter and end with a period. The program should generate 20 sentences and print on the screen. The arrays should be filled as follows: the article array should contain the articles "the", "a", "one", "some" and "any"; the noun array should contain the nouns "boy", "girl", "dog", "town" and "car"; the verb array should contain the verbs "drove", "jumped", "ran", "walked" and "skipped"; the preposition array should contain the prepositions "to", "from", "over", "under" and "on". https://code.sololearn.com/ckJVu0059Vq9/?ref=app

18th May 2020, 2:40 PM
himanshu
himanshu - avatar
3 Antworten
0
That's what not doing the code..? I see same output ( random picking of 6 words from 4 Arrays..) with the code.. Is not it? I didn't get your point.. Can you explain more..?
19th May 2020, 10:07 AM
Jayakrishna 🇮🇳
0
Forget to include header time. h Just add #include<time.h>
18th May 2020, 7:12 PM
Jayakrishna 🇮🇳
0
Sir,can i get this type of output by some changes in code, the sentences picked at random are: some town jumped onsome girl some girl van onsome town any town skipped toone town a car jmped oversome boy any boy ran toany girl any town skipped toone car some girl impress one girl any car ran toa dog one girl drove under one girl one dog the girl skipped fromone car skipped to dog a car drove undera girl a town drove on sone town some girl skipped under the boy the girl drove under the town some girls skipped fromany boy the car skipped under any car one girl drove ona car a dog ran overone boy the dog jumped from some boy
19th May 2020, 9:32 AM
himanshu
himanshu - avatar