Hi everyone. I don't really have access to a compiler or IDE right now, so I haven't tested it yet, but it looks like it would run okay.
My job is to check if a decimal number is a palindrome in binary.
int nDec;
int nTemp = nDec; //nTemp is a placeholder
//obtain number of bits in answer
//by finding number of divisions by 2
for(int n=0;nTemp!=0;n++)
{
nTemp = nTemp / 2;
}
nTemp = nDec;
constint t = n;
bool abRem[t] = 0;
bool abReverse[t] = 0;
//actual conversion and comparison
for(int iii=t-1;nTemp!=0;iii--)
{
abRem[iii] = nTemp % 2;
abReverse[t-m-1] = anRem[iii]
nTemp = nTemp / 2;
}
for(int jjj = 0;jjj<t;jjj++)
{
bool bSame = 0;
if(abRem[jjj]==abRev[jjj])
bSame = 1;
}
//code ends with an if statement to print
//nDec is a binary palindrome if bSame = 1
NB: just a code snippet, so I skipped the #include, couts and others.
Can anyone help me find any errors? Did I do a dangerous thing by storing the binary in an array, or by making the array boolean?