Question: C++ This problem is taken from a find your path book of the same name. The idea is you read a passage of text and
C++
This problem is taken from a "find your path" book of the same name. The idea is you read a passage of text and then decide which
of the presented options you will choose next. If you make good de- cisions, you will win (or in this case, survive). We can represent part
of this book with a flowchart, see figure 1. Paragraphs are indicated with "A" + a number. These also appear at the end of each passage and direct the reader where to read next. You are going to modify
that with a menu option. The reader will select a number and pro- gram execution will jump to that location. You will also notice words
in ALLCAPS. These are boolean variables reflecting your status as you progress through the story. You will need to keep track of these.
Requirements. The text for each function is listed below. Feel free to copy and paste this text. Re-prompt if incorrect data was entered. Keep re-prompting until the client gets it right. Style guide elements apply: comments, layout, Program Greeting, Source File Header, and variables etc. etc.
// Specification C1 - Individual Functions Each text passage (A1, A167, etc) is within its own function. Call the functions to progress through the story. You dont need to comment all the functions with this specification comment, just the first one. Hint: Call the functions by the passage identifier - makes your code easier to red. 3. // Specification C2 - Simple menu
Use a simple menu to call the next function. Just add this com- ment to the first one; you dont need to comment all of them. This
can be numeric. "B" Specification Bundle. 1. // Specification B1 - Booleans
When done, display the current state of all the BOOLEAN variables.
2. // Specification B2 - Path Display the path the client took through the story (use the A1, A167, etc. not the menu options) when the story is completed. 3. // Specification B3 - General Menu Code the menu in a general function which accepts up to 3 strings and returns an integer value for the chosen option. Call this from each function to generate your menu at the bottom of the text. 4. //Specification B4 - Valid choices only In A13, there is one option which cannot be taken unless a boolean variable is set. If the variable is set, only offer this option, suppress the other 2. 5. // Specification B5 Function Prototype Use function prototypes and code the functions under main(). "A" Specification Bundle. 1. // Specification A1 - Input Validation
Use input validation to allow only the correct menu values. Re- prompt until proper input is entered.
2. // Specification A2 - No Globals Do not use global variables to pass data around the program. Yes, you can put this comment where globals would normally go. 3. // Specification A3 - Game loop Wrap the program in a loop which prompts you to go again when you finish. 4. // Specification A4 - <> Add one feature of your own choosing.
butler to the dark lord (b2dl) 4
Paragraph Descriptions. A1. Well, Mr Artanon, look at you. Who would have thought that the son of a lowly spider farmer could rise to such esteemed heights?
1. Its you wholl get a rare cut across that corpulent neck of yours if you dont speed things along, you feckless blob of festering lard. (turn to A100) 2. Surely in such an industrious kitchen, there must be a starter or two ready to send along and sate His Abhorentnesss appetite? (turn to A167)
A100 Repugnis turns a paler shade of green, and gulps. "I beg you, Mr Artanon, stay your hand. Im sure that something must be ready."
1. Onwards, Mr Artanon. (turn to A232)
A167 Repugnis nods eagerly, which ripples his many chins. Yes sir, of course! Let me see now...
1. Onwards, Mr Artanon. (turn to A232)
A232
You overtake the footmen along a corridor lit by stuttering can- dles, and lead them through a wide archway into the airy dining hall.
Who will you serve first? 1. The enthusiastic Captain Haiken? (turn to A13) 2. Or your master, Malacandros? (turn to A290)
is the correct implement to use for rat heads. 1. Are you a DIPLOMAT? (turn to A212)
2. If not, do you simply inform him which is the proper rat-head- eating-fork? (turn to A159)
3. Or do you let him flounder? (turn to A173)
A290 As is only fitting, you serve your master first. As you place the largest and juiciest rat heads before him, your first footman Kalag
1. Excellent posture, Mr Artanon. (turn to A161) A159 You clear your throat and speak softly. "That little one there is
your rat-head-eating-fork, my lord."
1. Done A161 You move away from Haiken, whose hand still hovers uncertainly over the cutlery, to serve Mal rat heads.
1. Done A173 As they gnash away, Mal and Haiken discuss the Captains recent raid on the town of Greenflower.
1. Do you attempt to intercede on Peedys behalf? (Done) 2. Or abandon him to his miserable fate? (Done) In either case, both paths lead to the end of the homework, too. A212 You clear your throat very slightly, and Haiken glances up at you.
1. Nicely done, Mr Artanon. (turn to A161) Display Just indicate the game is finished.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
