Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need halp with this question i have the code that is mention in the white box

ID: 3625963 • Letter: I

Question

i need halp with this question i have the code that is mention in the white box 

if you need 

Explanation / Answer

DynStack.h // Specification file for the DynIntStack class #ifndef DYNSTACK_H #define DYNSTACK_H template class DynStack { private: // Structure for stack nodes struct StackNode { T value; // Value in the node StackNode *next; // Pointer to the next node }; StackNode *top; // Pointer to the stack top public: // Constructor DynStack() { top = 0; } // Destructor ~DynStack(); // Stack operations void push( T ); void pop( T & ); bool isEmpty(); }; #endif DynStack.cpp #include #include "DynStack.h" using namespace std; //************************************************** // Destructor * // This function deletes every node in the list. * //************************************************** template DynStack::~DynStack() { StackNode *nodePtr, *nextNode; // Position nodePtr at the top of the stack. nodePtr = top; // Traverse the list deleting each node. while (nodePtr != 0) { nextNode = nodePtr->next; delete nodePtr; nodePtr = nextNode; } } //************************************************ // Member function push pushes the argument onto * // the stack. * //************************************************ template void DynStack::push( T num ) { StackNode *newNode; // Pointer to a new node // Allocate a new node and store num there. newNode = new StackNode; newNode->value = num; // If there are no nodes in the list // make newNode the first node. if (isEmpty()) { top = newNode; newNode->next = 0; } else // Otherwise, insert NewNode before top. { newNode->next = top; top = newNode; } } //**************************************************** // Member function pop pops the value at the top * // of the stack off, and copies it into the variable * // passed as an argument. * //**************************************************** template void DynStack::pop( T &num ) { StackNode *temp; // Temporary pointer // First make sure the stack isn't empty. if (isEmpty()) { cout value; temp = top->next; delete top; top = temp; } } //**************************************************** // Member function isEmpty returns true if the stack * // is empty, or false otherwise. * //**************************************************** template bool DynStack::isEmpty() { bool status; if (!top) status = true; else status = false; return status; } main.cpp #include #include "DynStack.h" using namespace std; int main() { DynStack intStack; intStack.push( 5 ); return 0; } 2)Error checking: a.Returns whether the stack is empty, i.e. whether its size is 0. This member function effectively calls the member with the same name in the underlying container object.