Question: pl ans soon Task 2: Stack In this program (https:/www.onlinegdb.com/Was/32633), you need to complete these functions: 1. peak(); return the top of the element in






Task 2: Stack In this program (https:/www.onlinegdb.com/Was/32633), you need to complete these functions: 1. peak(); return the top of the element in the stack; return 0 and print out an error if stack is empty; (You can not use popping function) 2. popdup(): duplicate the top element in the stack; 3. popswap(): swap the top two elements in the stack; 4. clear(): clear the stack; You can add code in main function to test your functions but please don't touch other parts of the code. 1 include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
