212

#include<stdio.h>

int main(void)

{

         int blank,digit,other;

         char ch;

         int i;

         blank=digit=other=0;

         printf("Enter 10 characters:");

         for(i=1;i<=10;i++){

                   ch=getchar();

                   switch(ch){

                   case' ':

                   case'\n':

                            blank++;

                            break;

                   case'0':case'1':case'2':case'3':case'4':

                   case'5':case'6':case'7':case'8':case'9':

                            digit++;

                            break;

                   default:

                            other++;

                            break;

                   }

         }

         printf("blank=%d,digit=%d,other=%d\n",blank,digit,other);

 

         return 0;

}

posted @ 2013-10-03 10:57  zhaoyang16  阅读(120)  评论(0编辑  收藏  举报