code link : https://pastebin.com/C9ry4jrc
why I am getting a runtime error please correct it
Prateek Sir and Coding
replace while(s.top()<p[i] && !s.empty()) with while(!s.empty() && s.top()<p[i]).
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
but in my code i have no where used while(s.top()<p[i] && !s.empty()) or while statement please look into it @keshavgupta0103
My bad i looked at the other code. The problem in this code is that when choice == 1 you are not checking if the stack is empty please implement the same in your code.
If it is 1 then,
……2.1 pop and print the book.
……2.2 If stack is empty print No Code otherwise print price.