Question
Let's write a program to play a game of MADLIBS. Your task is to write a program to ask the user for different input words
Let's write a program to play a game of "MADLIBS".
Your task is to write a program to ask the user for different input words and phrases, from which the program will assemble a sentence.
The output from running the program should have this form:
** MADLIBS ** Enter a location (e.g. "the living room"): the basement Enter a verb (e.g. "sing"): dance Enter another verb: wiggle Enter an adjective (e.g. "greedy"): silly Enter an adverb (e.g. "noisily"): effortlessly Enter a noun (e.g. "peanut"): computer Enter a relative (e.g. "aunt"): sister My silly sister is convinced that if I dance effortlessly, I will be able to wiggle the computer in the basement.
Just in case you had forgotten
An ADJECTIVE describes something or somebody: lumpy, soft, ugly, short, blue, and slimy are adjectives.
An ADVERB tells how something is done. It modifies a verb and usually ends in "ly". Modestly, stupidly, greedily, and carefully are adverbs.
A NOUN is the name of a person, place or thing. Sidewalk, umbrella, peanut, bathtub, and nose are nouns.
A VERB is an action word. Run, jump, swim, and fly are verbs.
A LOCATION might be: United Kingdom, the moon, outer space, Disneyland, the kitchen, a dumpster, etc.
A RELATIVE might be: aunt, uncle, cousin, brother, etc.
The structure of the sentence will be as follows:
// My ADJECTIVE RELATIVE is convinced that if I VERB ADVERB, // I will be able to VERB the NOUN in LOCATION.
Hints:
1) Note that there should be a blank line both before and after the game title ** MADLIBS **.
2) Remember to escape double-quote characters to include them in a string.
3) Use the getline() function, rather than cin >> to be able to capture multiple words in one input.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started