A palindrome is a word that reads the same both forwards and backwards. Examples: anna, nitalarbralatin, amanaplanacanalpanama. Write a function that takes a string as parameter and returns true if the word is a palindrome, false otherwise. Also write a program palindrome.cc that reads words from the terminal and checks whether they are palindromes.
corolaron 0 Newbie Poster
Recommended Answers
Jump to Postwhy should I write such a program?
Jump to PostTake the string and spell it in reverse. Compare the two strings, if they match you got a palindrome. Now show us some code!
Jump to Post"dad" is a palindrome.
depends on the definition used. Some might say it's not a palindrome because the a isn't the same as another letter in the word (even though being of course identical to itself).
Jump to Postwell, if I were a teacher having to grade that I'd fail it immediately anyway.
Ugliest mix of C and C++ I've ever seen, global variables, very bad variable naming, etc. etc.
All 13 Replies
SpS 34 Posting Pro
jwenting 1,905 duckman Team Colleague
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
joshuatree 0 Newbie Poster
Rashakil Fol 978 Super Senior Demiposter Team Colleague
jwenting 1,905 duckman Team Colleague
brahle 0 Newbie Poster

iamthwee
brahle 0 Newbie Poster
jwenting 1,905 duckman Team Colleague
bumsfeld 413 Nearly a Posting Virtuoso
jwenting 1,905 duckman Team Colleague
gkmishr1 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.