您需要 登录 才可以下载或查看,没有账号?立即注册
// 字符串计数问题 #include <iostream> #include <string> using namespace std; int main() { int a = 0, b = 0, c = 0, i = 0; string s; cin >> s; for (; i < s.length(); i++) { if ('A' <= s[i] && s[i] <= 'Z') a++; else if ('a' <= s[i] && s[i] <= 'z') b++; else c++; } cout << a << " " << b << " " << c; return 0; }
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)
GMT+8, 2025-1-27 04:17
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.