音乐网站开发背景,济宁网络,网站为什么做静态,苏州网站建设费用1、提示并输入一个字符串#xff0c;统计该字符中大写、小写字母个数、数字个数、空格个数以及其他字符个数要求使用C风格字符串完成
#include iostreamusing namespace std;int main()
{char str[20];cout please enter the str:;gets(str);in…1、提示并输入一个字符串统计该字符中大写、小写字母个数、数字个数、空格个数以及其他字符个数要求使用C风格字符串完成
#include iostreamusing namespace std;int main()
{char str[20];cout please enter the str:;gets(str);int uppcaseCount 0; //定义大写字母的个数int lowcaseCount 0; //定义小写字母的个数int digitCount 0; //定义数字的个数int spaceCount 0; //定义空格的个数int otherCount 0; //定义其他字符的个数for(int i0; str[i]!\0;i){if(str[i]65 str[i]90){uppcaseCount;}else if(str[i]97 str[i]122){lowcaseCount;}else if(str[i]1 str[i]9){digitCount;}else if(str[i] ){spaceCount;}else{otherCount;}}cout Uppercase letter: uppcaseCount endl;cout Lowercase letter: lowcaseCount endl;cout Digits: digitCount endl;cout Space: spaceCount endl;cout Ohter characters otherCount endl;return 0;
} 2、思维导图