do- while格式写1.输入一行字符,分别统计出其中英文字母、空格、数字和其他字符的个数。

1.输入一行字符,分别统计出其中英文字母、空格、数字和其他字符的个数。


#include<iostream>
 using namespace std;
 int main()
 {
 char c;int a,b,x,y;a=b=x=y=0;
 do
 {
     if((c>='a'&&c<='z')||(c>'A'&&c<'Z'))
         a++;
     else if(c==' ')
         b++;
     else if(c>='0'&&c<='9')
         x++;
     else
     y++;
     

 }while((c=getchar())!='\n');
 //cout<<a<<" "<<b<<" "<<x<<" "<<y<<" "<<endl;
    cout<<a<<" "<<x<<" "<<b<<" "<<y-1<<" "<<endl;
}