#include <iostream>
using namespace std;
class palindrome
{
int temp, x, rev;
public:
int num;
void getdata();
void process();
void putdata();
};
void palindrome::getdata()
{
cout<<"\n Enter any one number to check : ";
cin>>num;
}
void palindrome::process()
{
temp = num;
while (temp>0)
{
x = temp % 10;
rev = rev * 10 + x;
temp = temp / 10;
}
}
void palindrome::putdata()
{
if (num == rev)
{
cout<<"\n "<<num<<" is a Palindrome Number.";
}
else
{
cout<<"\n "<<num<<" is Not a Palindrome Number.";
}
}
int main()
{
palindrome obj;
cout<<"\n --------------------------------------------";
cout<<"\n Palindrome Number Checking. ";
cout<<"\n --------------------------------------------";
obj.getdata();
cout<<"\n --------------------------------------------";
if(obj.num<0)
{
cout<<"\n The Given Value is an Negative Number....";
cout<<"\n Please Use Integer Numbers...";
cout<<"\n --------------------------------------------";
}
else
{
obj.process();
obj.putdata();
cout<<"\n --------------------------------------------\n\n";
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: