Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ You will create four functions: printYouWin() void return, no parameters printYouLose()- void return no parameters monsterAttacks() int return, no parameters heroAttacks(int atkBonus) int return,

C++ You will create four functions:

printYouWin() void return, no parameters

printYouLose()- void return no parameters

monsterAttacks() int return, no parameters

heroAttacks(int atkBonus) int return, integer parameter

Inside main you will have two int variables one for a monsters health and one for the heroeshealth. They will both be set to 20.

The program starts by calling heroAttacks() and send in an attack bonus (A random numberbetween 0 and 2).

Hero attack will return a random number between 1 and 5 + the attack bonus sent in.

The integer returned will be subtracted from the monsters health.

Then you will subtract the heros health from the integer returned from monsterAttacks()

Monster attack will return a random number between 1 and 6.

You should have a meaningful message print when each character takes damage

After one of the characters health falls below 0, then check to see if is the monster or the hero. Call you win/ you lose appropriately. please include function prototypes

#include

#include

#include

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions