Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Reverse a word using stack or queues Posted by browndragon on 1 Dec 2012 at 11:38 AM
Hello all,
I need to do a program to reverse a word a user enters using stacks or queues. It has to be really really simple (no crazy procedures).

I know how to do it with strings:

for i:=length(word) downto 1 do
backwardword:=backwardword + word[i];


if word = backwardword I also have a palindrome.

But I need to use ONLY stacks or queues (or both).

I know that a STACK would let me reverse its order easily by using POP but I can't understand how to do this using a word a user enters because I don't understand the syntax for stacks.

Besides this, as point 2: I need to check if the word is a palindrome.

Thanks in advance for your help.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.