Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Stack problem  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
i have been trying this stack problem using interface but not getting the desired output



OUPT:

Stack is full.
Stack is full.
The Stack1 is :
3
2
1
0
Stack is empty
0
The Stack2 is :
6
5
4
3
2

Please do reply
Thankx in advance
 
Ranch Hand
Posts: 144
Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check Line 66. You initialized your 2nd stack of size 8. You pushed 8 numbers in it and when its time to pop them you are running loop from 0 to 5. Change your loop condition for second stack output and you should have desired output.
 
Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your desired output?

Hunter
 
please buy my thing and then I'll have more money:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!