Question: Complete the following assignment using C++: Task 1: Create a stack class that will be used as the basis for the remainder of the lab

Complete the following assignment using C++:

Complete the following assignment using C++: Task 1: Create a stack class

Task 1: Create a stack class that will be used as the basis for the remainder of the lab I. 2. Create a new project Design a stack class using an array. This class should be a template. The constructor should include a parameter to indicate the size of the arrav The array holding the data should be an array of pointers The push function should accept a pointer and add that pointer to the top of the stack, It doesn't need to create any memory The pop function should return a pointer. It doesn't need to delete any memory The top function should return a pointer to the item on the top of the stack without removing it The length function will return an int indicating the number of items in the stack. a. b. c. d. e. f. g. The empty function should empty the stack of all contents. It needs to call delete h. The stack should declare a friend function that can access the underlying array for i. Create the implementation code for the above functions as required. Do not use to avoid memory leaks. It doesn't need to return any value the purposes of printing it to the screen. cout in the class. Any errors such as overflow or underflow should throw a custom class error

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!