Hello I need some help here
I don't have ideas to code a bool recursive function about palindrome.
How to return the value in bool function instead of 1,0?
Can someone give me some ideas about this function?
Thanks a lot.
// Check if a positive integer is a Palindrome
#include <iostream>
usingnamespace std;
bool isPalindrome( int number, int factor );
int main()
{
int number; // a positive integer
cout << "Enter a positive integer: ";
cin >> number;
// puts 10^(numDigits-1) (i.e., the smallest numDigits-digit positive integer) into factor
int temp = number;
int factor = 1; // power of ten
while( temp > 9 )
{
temp /= 10;
factor *= 10;
}
// print whether the number is a palindrome
if( isPalindrome( number, factor ) )
cout << endl << number << " is a palindrome." << endl << endl;
else
cout << endl << number << " is not a palindrome." << endl << endl;
system( "pause" );
}
bool isPalindrome( int number, int factor ){
}