Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stack problem

 
Deepak Monster
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
 
Zeeshan Sheikh
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.
 
Hunter McMillen
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic