I am writing a program which asks the user for input, how many digits to use, on 2 numbers which will multiply themselves. A loop will multiply all combinations of that number digits and determine the largest palindrome. I know how to do palidnromes with strings, but don't know if there is an easier way with integers. This is what I have to find the palindromes til now. Can someone help?
void multiplyNums(int *number)
{
char *stemp;
stemp = new char[80];
itoa(*number, *stemp, 10);
for(int i = 0; i < stemp.size(); i++)
if(isalnum(stemp[i]))
s += tolower(stemp[i]);
if(isPalin(s))
cout << stemp << " is a palindrome\n";
else
cout << stemp << " is not a palindrome\n";
}
bool isPalin(string& s)
{
for(int i=0; i<s.size(); i++)
if(tolower(s[i]) != tolower(s[s.size()-1-i]))
return 0;
return 1;
}