Question: c++ To examine a user-entered string to determine if it's a palindrome. A palindrome is a word that is spelled the same forward and backward,

c++

To examine a user-entered string to determine if it's a palindrome.

A palindrome is a word that is spelled the same forward and backward, such as "radar" or "madam." Your program should ask the user to enter a word, and then tell the user whether or not that word is a palindrome. Your program doesn't need to determine whether or not the word is in the English language. But you can assume that the word is made up of lower-case letters only, and that it is no more than 20 letters long. So for example your program would determine that the word "abcdefghijjihgfedcba" is a palindrome.

Here is some sample output from the program:

Please enter a word: radar The word you entered, 'radar' is a palindrome. Please enter a word: abccba The word you entered: 'abccba' is a palindrome. Please enter a word: abcddxba The word you entered: 'abcddxba' is not a palindrome. 

Requirements:

Your program must use at least one function in addition to main, and that function needs a comment summarizing it.

You must use a c-string (null-terminated character array) to store the word the user enters (as we have been doing all semester). You are not allowed to use the class "string" in this program.

To determine how many characters are in a c-string, use the strlen function. You will need to "#include ", and then if you have a c-string called "str" you can store its length in the variable "len" you would write: "len = strlen(str);"

Test your program with all of the above test cases.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!