淡泊明志 宁静致远
分类: C/C++
2006-12-08 23:04:51
【C语言库函数源代码】
【本程序在Dev C++ 4.9.9.2 下编译通过】
int my_ispunct( int ch )
{
return
isprint(ch) && !isalnum (ch)
&& !isspace (ch);
}//判断字符c是否为标点符号。标点符号指那些既不是字母数字,也不是空格的可打印字符。
int main()
{
char ch =
',';
if(my_ispunct(ch))
printf("%c is punctuation
Character!\n",ch);
else
printf("%c is not a punctuation
Character!\n",ch);
ch = '!';
if(my_ispunct(ch))
printf("%c is punctuation
Character!\n",ch);
else
printf("%c is not a punctuation
Character!\n",ch);
ch = '1';
if(my_ispunct(ch))
printf("%c is punctuation
Character!\n",ch);
else
printf("%c is not a punctuation
Character!\n",ch);
system("pause");
return 0;
}