Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

1. What are the pros and cons of diversity for an organisation?

Answered: 1 week ago

Question

1. Explain the concept of diversity and equality in the workplace.

Answered: 1 week ago