468,512 Members | 1,429 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Palindrome program in c++.?

help writing this palindrome program for my c++ class.
HERE WHAT THE CODE SHOULD BE LIKE.
Write a program that takes a line of input from the keyboard and check to see if that line is a palindrome. Your program should ignore blanks, punctuation, and lettercase

Your program should output what the user entered as well as the reversed line.

Sample output:

Please enter a phrase, and I will tell you if it is a palindrome.
>> Madam I'm Adam
You entered Madam I'm Adam
True. This IS a palindrome, the reversed string is madamimadam
Would you like to enter another phrase (y/n)
>> y
Please enter a phrase, and I will tell you if it is a palindrome.
>> Kayak
You entered Kayak
True. This IS a palindrome, the reversed string is kayak
Would you like to enter another phrase (y/n)
>> y
Please enter a phrase, and I will tell you if it is a palindrome.
>> Last Stall
You entered Last Stall
False. This is NOT a palindrome, the reversed string is llatstsal.

Thanks in Advance :)
Mar 11 '08 #1
2 3891
oler1s
671 Expert 512MB
Here is the answer to your question.
Mar 11 '08 #2
What's the problem?
Some advice
-check how you can remove spaces and turn everything lowercase
-then think about what a palindrome is
-think about how your "string" works.
Mar 11 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Lorin Leone | last post: by
23 posts views Thread by Amar Prakash Tripaithi | last post: by
32 posts views Thread by ramakrishnadeepak | last post: by
reply views Thread by Kesha | last post: by
3 posts views Thread by colinNeedsJavaHelp | last post: by
2 posts views Thread by Synapse | last post: by
4 posts views Thread by vicestner | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.