isalpha

王朝百科·作者佚名  2010-03-22  
宽屏版  字体: |||超大  

函数:isalpha

原型:int isalpha(int ch)

用法:头文件加入#include <ctype.h>

功能:判断字符c是否为英文字母,当c为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(c)||islower(c)”做测试,返回非零值,否则返回零。

示例:

/*本函数运行环境Visual C++ 6.0,测试结果 :通过*/

#include<ctype.h>

#include<stdio.h>

int main(void)

{

char ch;

int total;

total=0;//初始化

/*统计字母块*/

do

{

ch=getchar();

if(isalpha(ch)!=0)

total++;

}while(ch!='.');//结束符号为 .

printf("The total of letters is %d

",total);

return 0;

}

/*运行结果*/

输入:123456我am侯云江.

输出:The total of letters is 2

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有