C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 8, Problem 8.11E

(Random Sentences) Write a program that uses random-number generation to create sentences. The program should use four arrays of pointers to char 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 concatenated to the previous words in an array large enough to hold the entire 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 such sentences. 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”.

After the preceding program is written and working, modify it to produce a short story consisting of several of these sentences. (How about the possibility of a random term-paper writer?)

Blurred answer
Students have asked these similar questions
Indicate true or false for the following statements: Every element in an array has the same type. The array size is fixed after it is declared. The array size declarator must be a constant expression. The array elements are initialized when an array is declared.
Part 1: Randomizing an Array In this problem you will write a program that will randomize the elements of an array created by the user. 1. Prompt the user to enter an integer, then asks the user to enter that many values. Store these values in an array and print the array. Then re-shuffle the array elements so randomly. Do not just randomize the order in which they are printed; actually change the way they are stored in the array. Do not create a second array; just rearrange the elements within the array you have. (Hint: Swap elements that need to change places.) When the elements have been randomized, print the array again. 2. Create another version of your program that applies the following modification to the randomization process: elements that have been already swapped should not be swapped again. Example: if element 1 was swapped with element 10, when the 10 th element is reached it should not be swapped again. Yet if the 2 nd element is reached it can be swapped with the 10o the…
(FYI: Pseudocode is required (Not any programming language) Design a pseudocode program that loads an array with the following 7 values. Add one more word (of your own choosing) for a total of 8 words. biffcomelyfezmottleperukebedraggledquisling Be sure to use lowercase, as shown above. This will make the processing easier. Ask the user to enter a word Search through this array until you find a match with the word the user entered. Once you find a match, output "Yes, that word is in the dictionary". If you get to the end of the array and do NOT find a match, output "No, that word is not in the dictionary". The program should work with any set of words in the arrays. If I were to change the words in the arrays, it should still work. If you need help, look at the search example in your textbook.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
1.1 Arrays in Data Structure | Declaration, Initialization, Memory representation; Author: Jenny's lectures CS/IT NET&JRF;https://www.youtube.com/watch?v=AT14lCXuMKI;License: Standard YouTube License, CC-BY
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License