Question: I ' m writing a C + + program to call a function, please help me with the part shown in the picture, because some
Im writing a C program to call a function, please help me with the part shown in the picture, because some of the text parts can't be displayed on the page, so please look directly at the C program on the picture and teach me how to do it
#include
using namespace std;
const int MAXNMTOWER ;
const int MAXNMFLOOR ;
const int MAXENCOUNTERLENGTH ;
Helper function to copy values an array to another. Provided.
void copyfloorint to const int from
for int i; i MAXNMFLOOR; i
toi fromi;
Helper function to calculate strength based on operation
TODO:Given the current strength and an encounter, calculate the new strength.
An encounter is a C string that contains an operator and a number an integer egMM
The operator can be or M
and are normal addition and subtraction.
is multipication.
is integer division.
IM represents the monster encounter. If the current strength is greater than the number, you defeat the monster and add the number to the strength. Otherwise, assign to strength.
Note that you need to extract the number from the C string and convert it to an integer before performing the operation.
int calculatestrengthint strength, const char encounterMAXENCOINTERLENGTH
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
