Here is my function, taking an integer as an argument, then reversing it and comparing the original to see if the number is a palindrome.
1 2 3 4 5 6 7 8
|
bool isPalindrome(int n) {
string num = to_string(n);
string rNum = reverse(num.begin(), num.end());
if(num == rNum)
return true;
else
return false;
}
|
I keep getting the following compiler error:
Untitled.cpp:25:9: error: no viable conversion from 'void' to 'string' (aka 'basic_string<char, char_traits<char>, allocator<char> >')
string rNum = reverse(num.begin(), num.end());
|
Help would be appreciated. Thanks.
Last edited on