/*
编写函数:
int palindrome( char *string );
如果参数字符串是个回文, 函数就返回真, 否则就返回假.
回文就是指一个字符串从左至右和从右至左读都是一样的. 函数应该忽略所有的非字母字符, 而且爱进行字符比较时不用区分大小写.
提示:
空白字符, 标点符号和大小写应该被忽略. 当Adam(亚当)第一次遇见(Eve)夏娃时他可能会说一句:"Madam, I'm Adam!"就是一例回文.
*/
typedef char bool;
#define true 1
#define false 0
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
bool palindrome( char *str )
{
int counter;
char *const MarkStr = str;
/* 记录str字符串中大写字母加小写字母出现的次数 */
for( counter = 0; *str != '\0'; ++str )
{
if( islower( *str ) ||
C和指针_编程练习_第9章_第10题
最新推荐文章于 2024-07-24 22:47:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)