#include <stdio.h>
#include <string.h >
int main()
{
int i=0;
char s[80];
puts("input a cahracter string:");
gets(s);
int j=strlen(s)-1; //确定回文前后对称中,后面一个元素的下标
while(i<j)
{
if(s[i]==s[j])
{
i++;
j--;
}
else
break;
}
if(i>=j)
printf("%s是回文",s);
else
printf("%s不是回文",s);
return 0;
}
【编程练习6.13】判断数组s中的字符串是不是回文。
猜你喜欢
转载自blog.csdn.net/qq_41310074/article/details/104706128
今日推荐
周排行