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

来源:百度知道 编辑:UC知道 时间:2024/06/30 03:21:51
谢了

c语言如下 :
struct result
{
int character;
int spaces;
int decimal;
int other;
};
void check(char* str,struct result& ret)
{
if(str == NULL)
{
ret.character = ret.decimal = ret.spaces = ret.other =0;
return;
}
cout<<str<<endl;
while((*str) != '\0')
{
if((*str) == ' ')
++ret.spaces;
else if( (*str) >= '0' && (*str) <= '9' )
++ret.decimal;
else if((*str) >= 'a' && (*str) <= 'z')
++ret.character;
else if((*str) >= 'A' && (*str) <= 'Z')
++ret.character;
else
++ret.other;
str++;
}
}

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