Hey guys! I tried to write a menu driven STACK program but cannot get the desired output. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hey guys! I tried to write a menu driven STACK program but cannot get the desired output.

https://code.sololearn.com/cex7lKbjvB5n/?ref=app

16th Aug 2020, 10:43 AM
Manav Grover
2 Answers
+ 1
You need lot of changes.. 1) You should declare prototypes before main(just after the header, macros declarations..). 2) you have infinite loop, so use input 0 to as stop condition or number above 9 like while(choice! = 0) Or whjle(choice >=1 && choice <= 9) {..} 3) you are displaying by using pop function which decrementing top by top-=1; every time so after every time insert element, again you emptying stack.. Use a alias variables for temparary values like n= top; then use n; Hope it helps..
16th Aug 2020, 11:04 AM
Jayakrishna 🇮🇳
0
Thank you!
17th Aug 2020, 9:15 AM
Manav Grover