/*
*copyright (c) 2014, 烟台大学计算机学院.
*All rights reserved.
*文件名称:test.cpp
*作者:陆云杰
*完成日期:2014年11月8日
*版本号:v1.0
*
*
*问题描述:判断一个数是否为回文数
*程序输入:一个数字
*程序输出:判断这个数字是否是回文数
*/
#include <iostream>
using namespace std;
bool isPalindrome(int m);
int main()
{
int m;
cin>>m;
if(isPalindrome(m))
cout<<m<<"是回文数,噢耶!"<<endl;
else
cout<<m<<"不是回文数。回文有什么好!"<<endl;
return 0;
}
bool isPalindrome(int n)
{
int x=0,r,h=n;
while(n>0)
{
r=n%10;
x=x*10+r;
n=n/10;
}
if(x==h)
{
x=1;
}
else x=0;
return(x);
}
学习心得:bool型函数可以判断回文数!!