#include <iostream> #include <fstream> #include <string> #include <cstring> #include <vector> using namespace std; int is_huiwen(char *value,int low,int high,int len) { if(len == 0 || len == 1) return 1; if(value[low] == value[high]) { if(is_huiwen(value,low + 1,high - 1,len - 2) == 1) return 1; } return 0; } int main() { char value[256]; cout<<"输入一个字符串"<<endl; cin>>value; if(is_huiwen(value,0,strlen(value) - 1,strlen(value))) cout<<"是一个回文字符串"<<endl; else cout<<"不是一个回文字符串"<<endl; return 0; }