Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The heroCombat function accept the following input: Two Hero pointers, these are the heroes who will fight each other. An output stream to display the

The heroCombat function accept the following input:
Two Hero pointers, these are the heroes who will fight each other.
An output stream to display the results The function should reset the heroes' health (in case they've fought before). The heroes will fight until someone runs out of health. Each hero will select a random power (with the appropriate Hero function. The two powers will fight and the appropriate hero should lose 1 point of health - in the event of a tie, both lose health. At the end, indicate the winner.
A Note on Style
Be sure to comment your code.
As we discussed in lecture, it is extremely important that your code is properly indented as it greatly adds to readability. Because of this, if you submit a code file that is not reasonably indented, you will have points deducted.
Likewise, you will lose points if your variable names are not meaningful. Make sure you use variable names that correspond to what you are actually storing in the variables.
Hints
The graded tests are very exact about the output. In the example run, the yellow text indicates the text the tests check. You need to mimic my output, down to the spacing and new lines. Everything from dashes to the "goodbye" at the end must be identical.
It is a BadIdea to just quit your program. This assignment uses dynamic memory allocation (with the new keyword). However, we've not covered destructors yet. An additional 5 points of extra credit is available if you implement a destructor(s) correctly. No help on destructors is available on Piazza. Please only implement this after you've completed the assignment!
Full Sample Output
Below is sample output for a full run-through of the program. Your output should resemble the following - but doesn't need to match it exactly (user input is in red). The output highlighted in YELLOW goes to COUT (not the streams passed into fight), they will appear in your "main" output, but will not be part of the output file that goes through the automated tests.
Seed: 1700275251
Choose an option:
Load Heroes
Print Hero Roster
Hero Fight!
Quit
>1
Enter the file to load: input/heroes.txt
Choose an option:
Load Heroes
Print Hero Roster
Page 4 of 11
image text in transcribed

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions