c语言思想21

来源:互联网 发布:主题餐厅数据 编辑:程序博客网 时间:2024/05/24 05:29

1025

#include <stdio.h>

#include <string.h>
#include <stdlib.h>
#define MAX 50
int cycle(char *s)//回文判定
{
char *h,*t;
for(h=s,t=s+strlen(s)-1最高下标;t>h[两个地址的比较(把指针当成下标)];h++,t--)
if(*h!=*t) break;
return t<=h;
}


main()
{
char s[MAX];
system("cls");
while(1)
{
puts("Please input the string you want to judge (input ^ to quit):");
scanf("%s",s);
if(s[0]=='^')
break;
if(cycle(s))
printf(" %s is a cycle string.\n",s);
else
printf(" %s is not a cycle string.\n",s);
}
puts("\nThank you for your using,bye bye!\n");
}

=============================

1121

回文使用检查图像对称


0 0
原创粉丝点击