淡泊明志 宁静致远
分类: C/C++
2006-12-10 14:22:50
【C语言库函数源代码】
【本程序在Dev C++ 4.9.9.2 下编译通过】
int my_isgraph( int ch )
{
return (unsigned int)(ch -
'!') < 127u - '!';
}//判断字符c是否为除空格外的可打印字符。可打印字符(0x21-0x7e)。
int main()
{
char ch =
'_';
if(my_isgraph(ch))
printf("%c is a Graph
Character\n",ch);
else
printf("%c is not a Graph
Character!\n",ch);
ch = '1';
if(my_isgraph(ch))
printf("%c is a Graph
Character\n",ch);
else
printf("%c is not a Graph
Character!\n",ch);
ch = ' ';
if(my_isgraph(ch))
printf("%c is a Graph
Character\n",ch);
else
printf("%c is not a Graph
Character!\n",ch);
system("pause");
return 0;
}