漳州手机网站建设,网络广告发布的形式主要包括,海纳企业网站建设,网页前端模板思维导图#xff1a; 提示并输入一个字符串#xff0c;统计字符中大写、小写个数、空格个数以及其他字符个数要求使用C风格完成。
代码#xff1a;
#include iostream
#includearray
using namespace std;int main()
{string str;cout 请输…思维导图 提示并输入一个字符串统计字符中大写、小写个数、空格个数以及其他字符个数要求使用C风格完成。
代码
#include iostream
#includearray
using namespace std;int main()
{string str;cout 请输入一个字符串: ;getline(cin,str);int line(str.size());//记录有多长int big_num0;//大写个数int small_num0;//小写个数int num_num0; //数字个数int empty_num0;//空格个数int other_num0;//其他个数for(int i0;iline;i){if(str[i]Astr[i]Z)//大写字母{big_num;}else if(str[i]astr[i]z)//小写字母{small_num;}else if(str[i]0 str[i]9 )//数字个数{num_num;}else if(str[i] )//空格{empty_num;}else//其他符号{other_num;}}cout 这个字符串总共有 line 个字符 endl;cout big_num big_num endl;cout small_num small_num endl;cout num_num num_num endl;cout empty_num empty_num endl;cout other_num other_num endl;return 0;
}运行效果