1. 程式人生 > >c++學習(一)

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;

}