题目:输入十个字符,统计其中大写字母,小写字母,数字字符,空格和其他字符的个数。
样例输入
abc123## A
样例输出
1 3 3 1 2
=====================================================
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a;
int i;
int num1=0,num2=0,num3=0,num4=0,num5=0;
cin>>a;
for(i=0;i<=9;i++)
{
if(a[i]>=‘A‘&&a[i]<=‘Z‘)
{
num1++;
}
else
{
if(a[i]>=‘a‘&&a[i]<=‘z‘)
{
num2++;
}
else
{
if(a[i]>=‘0‘&&a[i]<=‘9‘)
{
num3++;
}
else
{
if(a[i]==‘ ‘)
{
num4++;
}
else
{
num5++;
}
}
}
}
}
cout<<num1<<‘ ‘<<num2<<‘ ‘<<num3<<‘ ‘<<num4<<‘ ‘<<num5<<endl;
return 0;
}
http://blog.tianya.cn/post-5285480-82795215-1.shtml
http://blog.tianya.cn/post-5285480-82795220-1.shtml
http://blog.tianya.cn/post-5285480-82795225-1.shtml
http://blog.tianya.cn/post-5285480-82795233-1.shtml
http://blog.tianya.cn/post-5285480-82795240-1.shtml
http://blog.tianya.cn/post-5285480-82795245-1.shtml
http://blog.tianya.cn/post-5285480-82795251-1.shtml
http://blog.tianya.cn/post-5285480-82795254-1.shtml
http://blog.tianya.cn/post-5285480-82795261-1.shtml
http://blog.tianya.cn/post-5285480-82795266-1.shtml
http://blog.tianya.cn/post-5285480-82795270-1.shtml
http://blog.tianya.cn/post-5285480-82795277-1.shtml
http://blog.tianya.cn/post-5285480-82795283-1.shtml
http://blog.tianya.cn/post-5285480-82795291-1.shtml
http://blog.tianya.cn/post-5285480-82795303-1.shtml
http://blog.tianya.cn/post-5285480-82795310-1.shtml
http://blog.tianya.cn/post-5285480-82795322-1.shtml
http://blog.tianya.cn/post-5285480-82795334-1.shtml
http://blog.tianya.cn/post-5285480-82795352-1.shtml
http://blog.tianya.cn/post-5285480-82795362-1.shtml
http://blog.tianya.cn/post-5285480-82795385-1.shtml
http://blog.tianya.cn/post-5285480-82795391-1.shtml
http://blog.tianya.cn/post-5285480-82795400-1.shtml
http://blog.tianya.cn/post-5285480-82795411-1.shtml
http://blog.tianya.cn/post-5285480-82795417-1.shtml
http://blog.tianya.cn/post-5285480-82795426-1.shtml
http://blog.tianya.cn/post-5285480-82795431-1.shtml
http://blog.tianya.cn/post-5285480-82795441-1.shtml
http://blog.tianya.cn/post-5285480-82795453-1.shtml
http://blog.tianya.cn/post-5285480-82795459-1.shtml
http://blog.tianya.cn/post-5285480-82795465-1.shtml
http://blog.tianya.cn/post-5285480-82795471-1.shtml
http://blog.tianya.cn/post-5285480-82795478-1.shtml
http://blog.tianya.cn/post-5285480-82795482-1.shtml
http://blog.tianya.cn/post-5285480-82795487-1.shtml
http://blog.tianya.cn/post-5285480-82795495-1.shtml
http://blog.tianya.cn/post-5285480-82795506-1.shtml
http://blog.tianya.cn/post-5285480-82795518-1.shtml
http://blog.tianya.cn/post-5285480-82795525-1.shtml
http://blog.tianya.cn/post-5285480-82795538-1.shtml
http://blog.tianya.cn/post-5285480-82795548-1.shtml