Sunday, December 7, 2014

Write a program Check whether the given number is palindrome or not. Use individual/separate member function to take input, output and display according to logic. Use Inheritance

#include<iostream>
using namespace std;
class palindrome
{
public:
void setvalue(int v)
{
value=v;
}
protected:
int value;
};
class value:public palindrome
{
public:
int i,t,rev=0;
int devide()
{
t=value;
while(t!=0)
{
i=t%10;
rev=rev*10+i;
t/=10;
}
}

int check()
{
if(value==rev)
cout<<"palindrome";
else
cout<<"not palindrome";
}
};
int main()
{
value v;
int x;
cin>>x;
v.setinput(x);
v.devide();
v.check();
}

1 comment:

  1. BetMGM Casinos - Mapyro
    See 1333 photos and 33 tips from 392 visitors 평택 출장안마 to Casino. "Very classy hotel. Very classy 여주 출장샵 place. Beautiful place to stay, clean 김제 출장샵 and my 바카라 사이트 유니88 friends have 전라남도 출장안마

    ReplyDelete