Question: ` ` ` #include using namespace std; / / Specification for the IntStack class class IntStack private: int * stackArray; / / Pointer to the
#include
using namespace std;
Specification for the IntStack class
class IntStack
private:
int stackArray; Pointer to the stack array
int stackSize; The stack size
int top; Indicates the top of the stack
public:
Constructor
IntStackint;
Copy constructor
IntStackconst IntStack &;
Destructor
~IntStack;
Stack operations
void pushint;
void popint &;
bool isFull const;
bool isEmpty const;
;
Specification for the MathStack class
class MathStack : public IntStack
public:
Constructor
MathStackint s : IntStacks
MathStack operations
void add;
void sub;
TO DO : Add below the declaration for the multiplication function
TO DO : Add below the declaration for the division function
TO DO : Add below the declaration for the modulus function
;
The main function section below demonstrates usage of the MathStack class.
int main
int catchVar; To hold values popped off the stack
const int STACKSIZE ; The minimum number of integers that the
stack can hold
Note that this usage portion of the MathStack class can be enhanced to
be user interactive. However, for this project and ease for the
evaluation, please simply use the noninteractive form below.
Create a MathStack object.
MathStack stackSTACKSIZE;
Push and onto the stack.
cout "Pushing
;
stack.push;
cout "Pushing
;
stack.push;
Add the two values.
stack.add;
Pop the sum off the stack and display it
cout "The sum is ;
stack.popcatchVar;
cout catchVar endl endl;
Push and onto the stack
cout "Pushing
;
stack.push;
cout "Pushing
;
stack.push;
Subtract from
stack.sub;
Pop the difference off the stack and display it
cout "The difference is ;
stack.popcatchVar;
cout catchVar endl;
TO DO : Provide below usage for the multiplication
TO DO : Provide below usage for the division
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
