+ 1
Palindromes & test
Hi! I wrote the code C++ for detect numbers palindromes, but the test #3 dont pass... https://code.sololearn.com/c8GXLenAU1q0/?ref=app What is numbers on test 3, which is calculated incorrectly?
6 Respostas
+ 2
I tested your code and it seems to work ok.
I tried entering 0123210, which returned false, so maybe this is the problem.
My suggestion:
Turn your integer into a string.
Reverse the string.
Compare the reversed string to the original string.
You may find this approach a lot simpler.
+ 2
You are manually defining the length by this line,
int a=5
either take in a string and assign to a the length of string. And then convert that string to number . Or you can follow what Rik Wittkopp suggested
+ 2
Thanx for all! Martin's advice helped.
How did you find out about libraries? On the course, "the reverse" did not find such a thing.
0
How to find zero at beginning of a number (int)? 010 for example