c回文游戏
// -
# include & ltstdio.h & gt
# include & ltstring.h & gt
Int is(char *str,size_t len) //判断长度为len的字符串str是否为回文。
{
int b=0,e = len-1;
while(b & lt;e)
{
if (str[b]==str[e]) {
b++;
e-;
}
否则返回0;
}
返回1;
}
int main(void)
{
char s[80];
scanf("%79s ",s);//输入一个字符串
If (is (s,strlen(s))printf(" % s \ "是回文\n ",s);
else printf(" % s \ "非回文\n ",s);
返回0;
}
// -