palindrome number problem
Hi everyone recently I've been learning about programming and I'm having some difficulties with this task: "Write a function that returns true if a given number is a palindrome, and false, if it is not. Complete the given function, so that the code in main works and results in the expected output. Sample Input: 13431 Sample Output: 13431 is a palindrome To check if a number is palindrome, you need to reverse it and compare with the original one." So far I've got this: but the program won't accept it, and I feel stuck. Can someone gime me some advice/ideas #include<iostream> using namespace std; int main() { int n,num,digit, rev=0; cout<<"Enter the number to check if it is a palindome or not: "<<endl; cin>>num; n=num; do { digit = num%10; rev=(rev*10)+digit; num=num/10; } while (num=!0) cout<<"the reverse number is: "<<rev<<endl; if(n==rev) cout<<"the number is a Palindome"<<endl; else cout<<"the number is not a Palindrome"; return 0; }