Question: c++ Write a program called ChocolateReplacementTherapy. When I run it, it should prompt me to enter a noun (or noun phrase) of my liking. It
c++
Write a program called ChocolateReplacementTherapy. When I run it, it should prompt me to enter a noun (or noun phrase) of my liking. It should then select a random quote about chocolate from its bank of quotes (If you like you may use the quotes provided below to make up your bank), replace all occurrences of the word chocolate with my noun (or noun phrase) and print the revised quote.
As an extra challenge, you could pay attention to the detail and make sure that the casing of the replaced word is preserved in the output. For example if I entered "Moon Dust Pixie Pie" in response to the prompt, a quote that had the word "Chocolate" may come out with Chocolate replaced by "Moon dust pixie pie" and a quote that had "chocolate" (in lower case) might come out with the replacement "moon dust pixie pie".
You may also choose to put the above user interaction into a loop so a user could keep experimenting with various replacements for Chocolate. Very therapeutic, yes? :-)
Implementation notes:
You should store the list of quotes in an array of strings, select one of these strings randomly upon the user's response, process it for replacement (A tip - Don't replace words in place - make a brand new string from scratch ("") appending words to it sequentially. Output this new string when done).
Here is some quote
"A little chocolate a day keeps the doctor at bay. - Marcia Carrington" "All you need is love. But a little chocolate now and then doesn't hurt. - Charles M. Schulz" "Anything is good if it's made of chocolate. - Jo Brand" "Caramels are only a fad. Chocolate is a permanent thing. - Milton Snavely Hershey" "Chemically speaking, chocolate really is the world's perfect food. Michael Levine" "Chocolate is a perfect food, as wholesome as it is delicious, a beneficent restorer of exhausted power. It is the best friend of those engaged in literary pursuits. - Justus Liebig" "Chocolate is medicinal. I just did another study that confirms it. - Michelle M. Pillow" "Chocolate is the only aromatherapy I need. - Jasmine Heiler" "Chocolate remedies adversity. - Jareb Teague" "Chocolate says 'I'm sorry' so much better than words. - Rachel Vincent" "Chocolate: The poor mans' champagne. - Daniel Worona" "Coffee and chocolate'the inventor of mocha should be sainted. - Cherise Sinclair" "I never met a chocolate I didn't like. - Deanna Troi" "If I die eating chocolate, I'll die happy. - Cailey Sims" "If there's no chocolate in Heaven, I'm not going. - Jane Seabrook"
Here is some sample output from a program I wrote earlier today:
Enter a clever noun (or phrase): X-Ray Vision All you need is love. But a little x-ray vision now and then doesn't hurt. - Charles M. Schulz
Enter a clever noun (or phrase): The Game of Drones The Game of Drones is medicinal. I just did another study that confirms it. - Michelle M. Pillow
Enter a clever noun (or phrase): Martian Crystal Spring Water If there's no martian crystal spring water in Heaven, I'm not going. - Jane Seabrook
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
