Question: 1. Given the following declaration class stack private: int elt[5]; int counter; public: void CreateStackO counter 0: void IsEmptyO f if( counter 0) return true;

 1. Given the following declaration class stack private: int elt[5]; int

1. Given the following declaration class stack private: int elt[5]; int counter; public: void CreateStackO counter 0: void IsEmptyO f if( counter 0) return true; else return false; void IsFull if ( counter 5) return true; else return false; void push( int x ) { elt[counter]--x; counter ++;} int pop() f int x; x - elt[counter -1 ]; --counter (5 points) We want to change the above class declaration to a template class to have a control on the size and the type of elements in the stack.. Cross out the changes you want to make and write the new changes. a. class stack private: int elt[5]: int counter; public: void CreateStackO &counter 0; void IsEmpty0 if( counter0) return true; else return false; void IsFull) { if (counter 5) return true; else return false; ) void push( int x) { elt[counter] x; counter ++;) int pop() -counter; return elt[counter ]J;) (10 points) Given stack S of size 10 whose elements are char type. Use the above declaration to write a program segment to make stack C a copy of stack S. Leave S unchanged

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!