做外贸网站的经验,公司网站年费,科技设计网站,湖南百度seo思维导图 使用C编写一个程序#xff0c;输入一个字符串#xff0c;统计大小写字母、数字、空格和其他符号的个数
#include iostreamusing namespace std;int main()
{int capital 0;int lower 0;int digit 0;int spaces 0;int others 0;cout 请…思维导图 使用C编写一个程序输入一个字符串统计大小写字母、数字、空格和其他符号的个数
#include iostreamusing namespace std;int main()
{int capital 0;int lower 0;int digit 0;int spaces 0;int others 0;cout 请输入一个字符串 endl;string str;getline(cin,str);for(int i 0;i str.size();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){digit;}else if(str.at(i) ){spaces;}else{others;}}cout 大写字母个数为 capital endl;cout 小写字母个数为 lower endl;cout 数字个数为 digit endl;cout 空格个数为 spaces endl;cout 其他字符个数为 others endl;return 0;
}