编辑代码

#include <iostream>
using namespace std;
bool is(char c[],int len){
    int i=0;
    len = len-1;
    while(len>i){
        if(c[i]!=c[len]) return false;
        i++;
        len--;
    }
    return true;
}
bool is2(char *s){
    int i=0,j=0;
    while(s[j])
        j++;
    //cout<<j<<endl;
    for(j--;i<j&&s[i]==s[j];i++,j--);
    //cout<<i<<endl;
    //cout<<j<<endl;
    return i>=j;
}//我操了,鬼才写法;
int main() {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
    int len=5,i=0;
    //char c[5];
    //c = new char[len];
    char *p;
    //p = new char[1];
    p="abccba"; 
    //cout<<p[3];
    //char c[5] = {'a','b','c','b','a'};
    //*c ='abcba';
    //cout<<*c[2];
    //cout<<c[0]<<cout<<c[4];
    cout<<is2(p);
	//cout << "Hello world!    - cpp.jsrun.net." << endl;
	return 0;
}