0
How do I solve the Palindrome C++ problem?
Palindrome
2 Answers
0
#include <iostream>
using namespace std;
bool isPalindrome(int x) {
//complete the function
}
int main() {
int n;
cin >>n;
if(isPalindrome(n)) {
cout <<n<<" is a palindrome";
}
else {
cout << n<<" is NOT a palindrome";
}
return 0;
}
0
One way would be to convert x into a string (use to_string(x)) and then compare characters, beginning with ending and work toward the middle.