网站开发的背景是指什么软件,沈阳小程序开发报价,网页设计好看的模板,找网站公司制作网站代码练习
输入一个字符串#xff0c;统计其中大写字母、小写字母、数字、空格以及其他字符的个数
#include iostreamusing namespace std;int main()
{cout 请输入一个字符串 endl;string str;getline(cin,str);int capital 0;int l…代码练习
输入一个字符串统计其中大写字母、小写字母、数字、空格以及其他字符的个数
#include iostreamusing namespace std;int main()
{cout 请输入一个字符串 endl;string str;getline(cin,str);int capital 0;int lower 0;int numb 0;int other 0;int size str.size();for(int i0;isize;i){if(str.at(i) A str.at(i) Z){capital;}else if(str.at(i) a str.at(i) z){lower;}else if(str.at(i) 0 str.at(i) 9){numb;}else{other;}}cout 大写字母 capital endl;cout 小写字母 lower endl;cout 数字 numb endl;cout 其他字符 other endl;return 0;
}
思维导图