Question: DCP5301 Data Structure and Algorithms Submission question Write a program to perform operation push and pop on a linked stack. The program will prompt the

DCP5301 Data Structure and Algorithms Submission question Write a program to perform operation push and pop on a linked stack. The program will prompt the user for input and will display the operation result accordingly:

1: Push - program prompt user input for number to be pushed into the linked stack.

2: Pop - program will remove one element from the linked stack.

3 : Exit - program will display all the element in the linked stack and exit the system. (Modify the full program in Chapter 5 on linked stack.) Sample output :

1 : Push

2 : Pop

3 : Exit Choose operation to perform

: 2 stack is enpty Choose operation to perform :

1 Enter a nunber to push : 40 Choose operation to perform :

1 Enter a nunber to push : 60 Choose operation to perform :

1 Enter a nunber to push : 70 Choose operation to perform

: 2 Number popped: 20 Choose operation to perform

: 3 Data in the stack : 60 40 Thank you

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 Programming Questions!