输入一行字符,分别统计出其中大写字母,小写字母,数字的个数

来源:百度知道 编辑:UC知道 时间:2024/06/01 10:34:22
帮忙。。谢谢大家!!!

#include<iostream>
#include<cstring>
using namespace std;
void main()
{
char str[100];
int count1=0,count2=0,count3=0;
cout<<"input the string:"<<endl;
cin>>str;
int size=strlen(str);
int i=0;
while(i<size)
{
if(str[i]>='a'&&str[i]<='z')
count1++;
if(str[i]>='A'&&str[i]<='Z')
count2++;
if(str[i]>='0'&&str[i]<='9')
count3++;
i++;
}
cout<<"the stirng has lowercase letter's amount: "<<count1<<endl;
cout<<"the stirng has capital letter's amount: "<<count2<<endl;
cout<<"the stirng has digital letter's amount: "<<count3<<endl;
}

题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。 编程:输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数。 输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。 输入一行字符,分别统计出其中的英文字母.空格.数字.和其他字符的个数! 输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数 任意输入一行字符,分别统计出其中英文字母、空格、数字和其它字符个数。 输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数. 求:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数 输入一行字符,分别统计出其中的英文字母,空格,数字和其他数值的个数 输入一行字符 统计出其中的英文字母