Here is the program :-
Output 1:-
==> STACK PROGRAM <==
1. PUSH
2. POP
3. DISPLAY
4. PEAK
0. EXIT
CHOISE >>|
Output 2:-
==> STACK PROGRAM <==
1. PUSH
2. POP
3. DISPLAY
4. PEAK
0. EXIT
CHOISE >>| 1
Enter element >>| 12
=================DISPLAY=================
12,
=========================================
Output 3:-
==> STACK PROGRAM <==
1. PUSH
2. POP
3. DISPLAY
4. PEAK
0. EXIT
CHOISE >>| 1
Enter element >>| 13
=================DISPLAY=================
12, 13,
=========================================
Output 4:-
==> STACK PROGRAM <==
1. PUSH
2. POP
3. DISPLAY
4. PEAK
0. EXIT
CHOISE >>| 2
Pop out element is 13...
=================DISPLAY=================
12,
=========================================
Output 5:-
==> STACK PROGRAM <==
1. PUSH
2. POP
3. DISPLAY
4. PEAK
0. EXIT
CHOISE >>| 3
=================DISPLAY=================
12,
=========================================
Output 6:-
==> STACK PROGRAM <==
1. PUSH
2. POP
3. DISPLAY
4. PEAK
0. EXIT
CHOISE >>| 4
=====TOP=====
12
=============
Output 7:-
==> STACK PROGRAM <==
1. PUSH
2. POP
3. DISPLAY
4. PEAK
0. EXIT
CHOISE >>| 2
Pop out element is 12...
=================DISPLAY=================
---- STACK IS EMPTY ----
=========================================
Attention readers! Don't stop learning now. Check out our articles to gain more knowledge.
0 Comments
If you have any doubt. Let me know.