How to write this program?please help?
Write a program that reverses the string contents of a stack (the top and bottom elements exchange positions, the second last element exchange positions, and so forth until the entire stack is reversed). Hint: You may use a second stack. The following diagram illustrates the exchange process.
A -------------------------> I
B ------------------------> H
C ------------------------> G
D -------------------------> F
E -------------------------> E
F -------------------------> D
G -------------------------> C
H -------------------------> B
I -------------------------> A
Copyright © 2024 1QUIZZ.COM - All rights reserved.
Answers & Comments
Break it down into steps by writing pseudocode, then translate that into actual code. Think of it as being similar to the Towers of Hanoi problem. Actually, now that I look at it, is is the Towers of Hanoi. Don't think of it as letters on a stack, think of it as rings on a stick.