+ 2
palindrome practice lesson
it keep expecting while before my if statement https://code.sololearn.com/cT1OVXLDcds8/?ref=app
6 Answers
+ 6
here is also a version using string to check for palindrome:
https://code.sololearn.com/cahk28iWx220/?ref=app
+ 4
The error is due to missing semicolon(;) after "return true"
But there is logic error too, I have made some changes, kindly do a bit of analysis and implement it
Then your code will give desirable output.
bool isPalindrome(int x) {
//complete the function
int digit,z, rev=0;
z=x;
while (z > 0) {
digit = z % 10;
rev = rev*10 + digit;
z /= 10;
}
if (x == rev) return true; else return false;
}
here is the edited code!!!! The gun whose owner used to kill Abraham Lincoln
https://code.sololearn.com/cuB7pL1I5w9D/?ref=app
+ 2
The thing is i dont know those method xF. Well i know that those function exist since i am familiar with other code language as well but i thought that u have to import those or something.
still a newbie to c++
+ 1
Use semicolons
if (x == rev) return true; else return false;
+ 1
bless y all
+ 1
i have consider using string variable but dont know how to reverse äč[ â ᎄ â ]ă