c++判断回文数
#include <iostream>
using namespace std;
int main()
{
int a = 0;
int n = 0;
cout << "请输入要判断的数字:" ;
cin >> n;
int b = n;
while (n != 0)//求出n对应的回文数
{
a = a *10 + n % 10;
n = n / 10;
}
cout << endl;//此行仅是为了美观23333
if (a == b)//判断回文数与预想值是否相等
cout << "这是回文数" << endl;
else
cout << "这不是回文数" << endl;
return 0;
}