Question: First check the file stackType.h ( attached to this assignment ) , which contains both the declarations and definitions of the member functions for the
First check the file stackType.h attached to this assignment which contains both the declarations and
definitions of the member functions for the Stack class. Write the functions to do the following:
Write a nonmember function, named multiplyStackItemsBy that multiplies every
element in an integer stack by Do not use recursion. The function has the prototype of
void multiplyStackItemsBystackType &S;
Example: If the stack S contains the items
Where is the top of the stack, and you call the function as in
multiplyStackItemsByS;
The stack content will then become
Reimplement the nonmember function in the previous question using recursion. Call the function
multiplyStackItemsByRec.
Write a recursive nonmember function, named findMinAndMaxStack, that simultaneously
finds the minimum and maximum values in a given integer stack.
For example, if the stack S contains the items
The function should return as the minimum and as the maximum values. Assume that the
prototype of the function is as follows:
void findMinAndMaxStackstackType &S int &minval, int &maxval;
So minimum, and maximum values must be returned through the reference formal parameters of
minval and maxval. If the stack S originally is empty, do nothing and just return from the
function.
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
