- 判断回文字符串,并输出
#include<iostream>
using namespace std;
//回文字符串
//如abdba,即正着读和反着读都相同
int main() {
cout << "please input a string" << endl;
char c[50], ch;
int i,j;
gets_s(c);
for (i = 0; c[i] != '\0'; i++);
for (j = 0; j < i / 2; j++) {
if (c[j] != c[i - 1 - j]) {
cout<<"It is not a palimdrome string" << endl;
return 0;
}
}
cout << "It is a palimdrome string" << endl;
return 1;
}