Hi all,
I am currently working on a program which tests whether 2 numbers multiplied produces a PALINDROME.
An example of a palindrome is
16461
which can be read same from both ways hence i devised a test.
#include <iostream>
#include <string>
using namespace std;
char pali(char orig[100]);
int main()
{
for(int a=100;a<1000;a++)
{
for(int b=100;b<1000;b++)
{
if(pali(a*b)==1)
{
cout<<a*b;
break;
}
}
}
}
char pali(char orig[100])
{
char test[100]
int c=0;
for(int b=strlen(orig);b>=0;b--)
{
orig[b]=test[c];
c++;
}
if(strcmp(orig[100],test[100])
{
return 1;
}
else
{
return 0;
}
}
The problem is that i get errors that i cant convert a int into char. even when i use a cast..
Help me out