//判断回文数 bool palindrome(int n) { int s = n, ans = 0; while(s != 0) { ans = ans * 10 + s % 10; s = s / 10; } if(ans == n) return true; else return false; } //判断回文串 bool palindrome(char *s) { int n = strlen(s); int i, j, count = 0; for(i = 0, j = n - 1; i < n, j >= 0; i++, j--) { if(s[i] == s[j]) count++; } if(count == n) return true; else return false; }