作业3.3

#include<stdio.h>
int main(void)
{
 int letter,digit,blank,other;
 char ch;
 int i;
 letter=digit=blank=other=0;
 printf("Enter 15 characters:");
 for(i=1;i<=15;i++){
  ch=getwchar();
  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;
}

 

posted @ 2013-10-19 17:06  zhaoyang16  阅读(107)  评论(0编辑  收藏  举报