Question
At home 60 pts (deadline: 11:00 am 2/10/2021): - implement the Stack ADT using the linked list approach: - implement constructor, copy constructor, assignment operator,
At home 60 pts (deadline: 11:00 am 2/10/2021):
- implement the Stack ADT using the linked list approach:
- implement constructor, copy constructor, assignment operator, destructor; (25 pts) -
push, pop; (25 pts) -
clear , isFull, isEmpty; (10 pts)
//-------------------------------------------------------------------- // // Laboratory 6 StackArray.h // // Class declaration for the array implementation of the Stack ADT // //--------------------------------------------------------------------
#ifndef STACKARRAY_H #define STACKARRAY_H
#include
using namespace std;
#include "Stack.h"
template
public:
StackLinked(int maxNumber = Stack
void push(const DataType& newDataItem) throw (logic_error); DataType pop() throw (logic_error);
void clear();
bool isEmpty() const; bool isFull() const;
void showStructure() const;
private:
class StackNode { public: StackNode(const DataType& nodeData, StackNode* nextPtr) { dataItem = nodeData; next = nextPtr; }
DataType dataItem; StackNode* next; };
StackNode* top; };
#endif //#ifndef STACKARRAY_H
#include "StackLinked.h"
template
// Creates a stack node containing item newDataItem and next pointer // nextPtr.
: dataItem(newDataItem), next(nextPtr) { }
template
template
template
{ }
template
template
template
template
template
template
template
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started