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