A. Write a value‐returning function called length() that takes a positive integer and
returns the number of digits in that integer.

B. Using the written function in part A, write a value‐returning function called ispalindrome(),
while 5675 is not palindrome. The function takes a positive integer and
returns true if the integer is a palindrome and false otherwise.
Test your functions by writing a main function that prompts the user to input an integer
and outputs its number of digits and "It Is a Palindrome" message if it is a palindrome,
otherwise "It Is not a Palindrome".

Recommended Answers

All 5 Replies

So what seams to be your problem? We do not give answers here but we do offer assistance.

What NathanOliver said, plus we aren't here to help you cheat on your homework assignments. Make an honest effort to solve the problem, post your work here, and we will make appropriate comments.

As NathanOliver and rubberman said, at least post your source code here. We need to see a bit of effort before we provide assistance.

Do your best and attempt each question. It's only when you encounter an issue that we can be of further assistance.
Moreover, there is plenty of resources around around daniweb. Search around and take bits and pieces and stick them together ;)

Member Avatar for jencas

Use two std:string and initalize them both with the word. Use std::reverse() on the second string. If both strings are same after that, the word is a palindrome

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.