淡泊明志 宁静致远
分类: C/C++
2006-12-08 22:47:51
【C语言库函数源代码】
【本程序在Dev C++ 4.9.9.2 下编译通过】
int my_isdigit( int ch )
{
return (unsigned int)(ch -
'0') < 10u;
}//判断字符c是否为数字
int main()
{
int ch = 'A';
if(my_isdigit(ch))
printf("%c is Digital
Number!\n",ch);
else
printf("%c is not a Digital
Number!\n",ch);
ch = '1';
if(my_isdigit(ch))
printf("%c is Digital
Number!\n",ch);
else
printf("%c is not a Digital
Number!\n",ch);
system("pause");
return 0;
}