Specify and implement the ADT stack for integers. Use thisdata structure for reading a sequence of integers and for writingthem on the console in reverse order. The reservation memory isstatic. !!!!DONT NEED THE TOP PORTION!!!! Repeat the problem for a generic type T, dynamic memorymanagement and control of exceptions. Specify and implement the ADT stack for integers. Use thisdata structure for reading a sequence of integers and for writingthem on the console in reverse order. The reservation memory isstatic. !!!!DONT NEED THE TOP PORTION!!!! Repeat the problem for a generic type T, dynamic memorymanagement and control of exceptions.
Explanation / Answer
#includeusing namespace std;template class Stack{public:Stack(int s) {size=s;top=-1;stackPtr = new T[size];}~Stack() { delete [] stackPtr ; }int push(const T&a){cout