Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stacks Need Help

 
Alan Green
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say if i have created two different stacks,and any integer over 10 goes in one stack(bigStack). If less than 10 goes in one stack(theStack). The program is already working where it will resize if its full,but I am trying to put the integers in the right Stack. This is what I have so far.


[ Jess added UBB [code] tags to preserve whitespace, check 'em out! ]
[ September 23, 2003: Message edited by: Jessica Sant ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,
I find it really hard to believe that you could understand the program above, but still need to ask this question. It's important to take the time to read and understand code the code you're working with; you're not going to learn anything otherwise.
That said, in a loop near the end of the program, you're reading each line, parseInt()-ing it, and pushing it onto a stack. All you need to do is use an "if" statement to choose between the two stacks -- i.e., "if (next < 10) ... else ..."
[ September 22, 2003: Message edited by: Ernest Friedman-Hill ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic