赞
踩
#include<stdlib.h> #include<stdio.h> #define MAXSIZE 100 bool judge() { int n = 0; char arr[MAXSIZE], c=0; while (c != '#') { c = getchar(); arr[n++] = c; } char *front = arr, *rear = arr + n-2; while (rear >= front) { if (*front != *rear) return false; front++; rear--; } return true; } int main() { if (judge()) printf("是回文"); else printf("不是回文"); while (1); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。