c++学习(一)

//判断是否是回文数

#include"pch.h"
#include<iostream>
using namespace std;
bool systm(unsigned n)
{
unsigned i = n;
unsigned m = 0;
while (i>0)
{
m = m * 10 + i % 10;
i /= 10;
}
return m == n;
}
int main()
{
unsigned x;
bool result;
cout << "please input your number:";
cin >> x;
result =systm(x);
cout << "the result is:" << result;
cout << endl;

}

猜你喜欢

转载自www.cnblogs.com/chuxinbubian/p/10129406.html
今日推荐