int reser (int x) //把x倒过来 { int _x = 0; while (x != 0) { _x = _x * 10 + x % 10; x /= 10; } return _x; } bool isHW (int num) //判断是否回文 { if (num == reser(num)) return true; else return false; }