C++编程:从键盘输入任意字符串,统计其中大写字母的个数。

日期:2016-01-29 17:04:08 人气:1

C++编程:从键盘输入任意字符串,统计其中大写字母的个数。

//刚写的code,测试通过,如果有疑问,欢迎交流#includeusing namespace std;int main(){ char str[1000]; gets(str); int count = 0; int cur_idx = 0; while(str[cur_idx]!='\0'){ if(str[cur_idx] >= 'A' && str[cur_idx] <= 'Z'){ count++; }
    A+
热门评论