参考别人编写的判断回文字符
2010-11-26 20:57
197 查看
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 50
int cycle(char *s)
{
char *a,*b;
for(a=s,b=s+strlen(s)-1; b>a ;a++,b--)
{
if(*a!=*b)
{
break;
}
}
return b<=a;
};
int main()
{
char m
;
int t;
scanf("%s",m);
if(cycle(m))
printf("%s is cycle string/n",m);
else
printf("s is not cycle string/n");
return 0;
};
#include<string.h>
#include<stdlib.h>
#define N 50
int cycle(char *s)
{
char *a,*b;
for(a=s,b=s+strlen(s)-1; b>a ;a++,b--)
{
if(*a!=*b)
{
break;
}
}
return b<=a;
};
int main()
{
char m
;
int t;
scanf("%s",m);
if(cycle(m))
printf("%s is cycle string/n",m);
else
printf("s is not cycle string/n");
return 0;
};
相关文章推荐
- 编写判断一个字符序列是否为回文。回文是指一个字符序列以中间 字符为基准两边字符完全相同,即顺着看和倒着看是相同的字符序列。
- 算法基础——判断一个字符串至多添加一个字符之后是否回文
- 判断回文 字符串的最后一个字符是'/0', 而不是'/n' ,基础知识都忘了
- 编写函数,判断一个字符串是否是回文
- 输入一个字符串,判断该字符串插入一个字符,能否使其成为回文字符串
- 判断回文字符(包含去空格)
- 判断回文字符
- 判断一个字符串通过变化字符的位置,是否可以组成回文
- 如何编写C语言程序判断一个字符是否是字母或数字
- 判断字符序列是否为回文
- 判断回文字符序列-栈的使用
- 十五周—判断 字符回文
- STL学习-字符串回文判断以及实现删除字符串中重复字符最少字符
- 判断是否为回文数或回文字符
- 判断字符是不是回文
- 笔试题——编写java程序:输入一个字符串,判断有几个英文字母,有几个数字,有几个其它的字符
- 判断给定的一串字符是否为“回文”。所谓“回文”是指顺读和倒读都一样的字符串。
- 判断回文字符串(给定开始位置和字符个数)
- 输入一串字符,字符个数不超过100,且以“.”结束。 判断它们是否构成回文。
- c 判断回文字符