标签:
1 #include <iostream> 2 using namespace std; 3 int main() 4 {char c; 5 int letters=0,num=0,kongge=0,other=0; 6 while((c=getchar())!=‘\n‘) 7 {if ((c>=‘a‘ && c<=‘z‘)||(c>=‘a‘ && c<=‘z‘)) 8 letters++; 9 else if (c>=‘0‘ && c<=‘9‘) 10 num++; 11 else if (c==‘ ‘) 12 kongge++; 13 else 14 other++; } 15 cout<<letters<<" "<<num<<" "<<kongge<<" "<<other<<endl; 16 return 0; 17 }
标签:
原文地址:http://www.cnblogs.com/wangmengmeng/p/4542551.html