编辑代码

#include <iostream>
using namespace std;
bool huiwen(const char*str,int strLen){
    if(strLen<=1)
        return true;
    if(str[0]==str[strLen-1])
    {
        return huiwen(str+1,strLen-2);
    }
    return false;
}
int main() {
    char str[]="aaaabaaaa";
    int flag=huiwen(str,9);
    if(flag)
    cout<<str<<"is a palindrome."<<endl;
    else
    cout<<str<<"is not a palindrome."<<endl;
	return 0;
}