/*
*Copyright (c) 2014, 烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作者:陈栋梁
*完成日期:2014年 11 月 7日
*版本号:v1.0
*
*问题描述:
*输入描述:
*输出描述:
*/
#include <iostream>
using namespace std;
bool ispalindrome(int);
int main()
{
int m,n;
cin>>m;
if(ispalindrome(m))
cout<<m<<"是回文数,噢耶!"<<endl;
else
cout<<m<<"不是回文数,回文数有什么好!"<<endl;
return 0;
}
bool ispalindrome(int x)
{
bool ispalindrome=false;
int r=0,m;
m=x;
while (x>0)
{
r=r*10+x%10;
x=x/10;
}
if(r==m)
ispalindrome=true;
return ispalindrome;
}
运行结果: