0
Error In C++ Compile
Palindrome Problem #include <iostream> using namespace std; bool isPalindrome(int x) { //complete the function int num; num = x; int remainder = 0; int reversed = 0; while (num != 0){ remainder = num % 10; reversed = (reversed * 10) + remainder; num = num / 10; } return x == reversed; int main() { int n; cin >>n; if(isPalindrome(n)) { cout <<n<<" is a palindrome"; } else { cout << n << " is NOT a "; } return 0; }
2 Answers
+ 1
Missing a closing curly bracket for isPalindrome function !
+ 1
You are missing a curly bracket in the isPalindrome function.