![]() |
#2
沧声笑2010-09-29 22:27
|
#include<iostream>
using namespace std;
int main()
{
int m=0,n=0,p=0,b=0,i=1;
char a[10];
gets(a);
while(a[i]!='\0')
{
if((a[i]>=65&&a[i]<=90)||(a[i]>=97&&a[i]<=122))
m++;
else if(a[i]>=48&&a[i]<=57)
n++;
else if(a[i]=' ')
p++;
else
b++;
i++;
}
cout<<"字母有:"<<m<<"数字有:"<<n<<"空格有:"<<p<<"其他字符有:"<<b<<endl;
}