网站开发实用技术第二版答案,徐州做网站建设的公司,网站年报公示怎么做,沈阳妇科私立医院排名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思维导图