Please help me, lets assume that we have an empty stack in the program when executed. When I pop 2 or more it displays the "Stack is empty" a few times. How to set it to display or cout the "Stack is empty" only once? When I pop more than one it displays the stack is empty a few times based on my input number of how many I want to popped off.
Data structures (stacks, linked lists, hash tables, etc.) are not normally responsible for printing anything. Instead it is the code that uses them that do the printing. I would suggest you do the same. Instead of printing the stack is empty from inside the pop() function you could check if the stack has become empty in main() before calling pop(), and if it has you print the message and abort the pop loop.