Question: 11. You are to write a program that plays MadLib. You are to create a blank file, called madLibInput.txt. In this file, you are going

 11. You are to write a program that plays MadLib. You

11. You are to write a program that plays MadLib. You are to create a blank file, called madLibInput.txt. In this file, you are going to type: adjective food noun appliance verb food meat animal plant liquid color food adjective plant After each of these words, your player will write one word of that type. For example, when done, the first three lines of the file could read: adjective big food celery noun phone Provided with the HW is a file you will upload, called RawStory.txt. In this file is a story, but with several words missing. The missing words are represented by the character string $N$. These missing words will be replaced with the words your player entered in madLibInput.txt. Note that your player will not see RawStory.txt, but will just randomly choose an adjective, etc. The idea of a MadLib, is that these random responses will be used to replace the blanks ( $N ), often resulting in a funny (or silly) story. Your program will write this store out to a file called MadLibStory.txt, which your player will read. Your C++ program will thus do the following. Open the input files madLibInput.txt and Raw Story.txt. Also, open the output file MadLibStory.txt. Begin to read in RawStory.txt word by word, and writing out word per word the story to MadLibStory.txt. However, if a word read is the string \$N\$, read in the next word input from madLibInput.txt. Be careful as you need to read two words in, the word type (such as adjective), which you will not use. Then read the word the user entered. Write this word out to MadLibStory.txt instead of \$N\$. Note that you will have to add spaces before (or after) words. The exception is punctuation. When the end of file of RawStory.txt is reached, close the files and invite the player to read MadLibStory.txt. Make a flow-diagram of your function first, which you will turn in. Use this to write your program. (16 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!