函数:isalpha
原型:int isalpha(int ch)
PS:{
isupper
说明:当参数c为大写英文字母(A-Z)时,返回非零值,否则返回零。
islower
相关函数
isalpha,
isupper
表头文件
定义函数
int islower(int c)
函数说明
检查参数c是否为小写英文字母。
返回值
若参数c为小写英文字母,则返回TRUE,否则返回NULL(0)。
}
示例:
#include<ctype.h>
int main(void)
{
char ch;
int total;
total=0;//初始化
/*统计字母块*/
do
{
ch=getchar();//从键盘输入一个字符型数据,把值赋给变量ch
if(isalpha(ch)!=0)
total++;
}while(ch!='.');//结束符号为 .
printf("The total of letters is %d \n",total);
return 0;
}
/*运行结果*/
输入:123456我am侯云江.
输出:The total of letters is 2