安徽省网站肥建设网站,动力无限西安网站建设,网站设计的公司选哪家,网络推广方案的概念1提示并输入一个字符串#xff0c;统计该字符中大写、小写字母个数、数字个数、空格个数以及其他字符个数要求使用C风格字符串完成。
代码#xff1a;
#include iostream
#include string.h
using namespace std;int main()
{string str ;int low 0, …1提示并输入一个字符串统计该字符中大写、小写字母个数、数字个数、空格个数以及其他字符个数要求使用C风格字符串完成。
代码
#include iostream
#include string.h
using namespace std;int main()
{string str ;int low 0, up 0, num 0, blank 0, other 0;cout Please input a string: endl;getline(cin,str);for (int i 0; i str.size() ; i) {if(islower(str[i]))low;else if(isupper(str[i]))up;else if(str[i] )blank;else if(str[i] 48 str[i] 57)num;elseother;}cout low low endl up up endl num num endl blank blank endl other other endl;return 0;
}结果 2思维导图