Click to See Complete Forum and Search --> : pseudocode help


indianj
10-23-2005, 04:02 PM
hi, i was going through java exercise and i did not understand this exercise. if you know anything, please post your comment here.


Consider the following pseudocode:

declare a stack of characters
while ( there are more characters in the word to read )
{
read a character
push the character on the stack
}
while ( the stack is not empty )
{
pop a character off the stack
write the character to the screen
}

What is written to the screen for the input "carpets"?
A. serc
B. carpets
C. steprac
D. ccaarrppeettss

Waylander
10-23-2005, 08:52 PM
Why dont you write a small program and find out?

This must be abut the tenth "exercise" you have posted.

I mean you could at least use the same thread.

chazzy
10-23-2005, 09:04 PM
perhaps you could tell us what you did not understand and we could answer instead of us doing your homework :-)