大家帮帮忙 回文序列
写一个算法,如何判断一个字符串是不是回文序列?
#include <stdio.h> #include <stdbool.h> int main (void) { char str[81]; bool ishui (char str[]); //Input a character strings. printf ("Enter a string :"); scanf ("%s",str); if(ishui(str)){ printf ("Yes\n"); }else{ printf ("No\n"); } return 0; } bool ishui (char str[]) { int i=0,j,len=0; bool is; //Get length of chararray while(str[len]!='\0') { len++; } //Get last element position j=len-1; //Head/tail element compare while(i<=len/2){ if(str[i]!=str[j]){ return is=false; } i++; j--; } return is=true; }