您的位置:首页 > 其它

作业3(3)

2013-10-19 22:02 127 查看
#include<stdio.h>
int main(void)
{
int letter,blank,digit,other;/*定义整数型变量*/
char ch;
int i;
letter=blank=digit=other;
printf("Enter 15 characters:");
for(i=1;i<=15;i++){/*判断当i<=15时*/
ch=getchar();
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))/*判断*/
letter++;
else if(ch>='0'&&ch<='9')
digit++;
else if((ch='\n')||(ch=' '))
blank++;
else
other++;

}
printf("letter=%d,digit=%d,blank=%d,other=%d\n",letter,digit,blank,other);
return 0;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: