标签:
#include<iostream> using namespace std; #include<assert.h> bool isPalindromeNumber(long num) { if(num<0) return false; long temp=num; long y=0; while(temp) { y=y*10+temp%10; temp/=10; } return num==y; return false; } bool isPalindromeChar(char *c) { assert(c!=NULL); char *temp=c; while(*++c!='\0') { NULL; } while(temp < c) { if(*temp++ != *--c) return false; } return true; } int main() { char a[]="abcba"; if( isPalindromeChar(a)) { cout<<"hahahahahaha,successful"<<'\n'; } else { cout<<"enenenenenen,false"<<'\n'; } system("pause"); return 0; }
标签:
原文地址:http://blog.csdn.net/kai8wei/article/details/44857217