Question: (bandit.cpp) Write a C++ program that simulated an encounter in an RPG game. You are a lone traveler in the woods. Suddenly, a bandit appears

(bandit.cpp) Write a C++ program that simulated an encounter in an RPG game. You are a lone traveler in the woods. Suddenly, a bandit appears in front of you demanding you to give him all your money. You have the following choices: 1. Try to flee. 2. Fight! 3. Try to persuade him that robbery is bad, and he is better than that. Input 1, 2, 3 to make the choice. Check that input is valid (1, 2, or 3). Now simulate the outcome. Let's flee has 20% chance of success, fight has 50% chance of winning, and persuasion has 5% chance of success. Display the outcome of the encounter. Make a separate outcome message for each possible outcome. The exact messages are up to you. The only requirement is that they are descriptive. Here is a sample run: You are a lone traveler in the woods. Suddenly, a bandit appears in front of you demanding you to give him all your money. You have the following choices: 1. Try to flee. 2. Fight! 3. Try to persuade him that robbery is bad, and he is better than that. Please enter your choice (1,2,3): 2 You draw out your sword and fought! It was a close one, but you managed to defeat the bandit! Have fun with this one
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
