题目描述:
算算以‘.’结束的一串字符中含有多少个大写的英文字母。
输入
输入一串字符,以.结束
输出
输出一行,即这串字符中大写字母的个数。
样例输入
PRC,PRC,I’m from China.
样例输出
8
#include <bits/stdc++.h>
using namespace std;
int main()
{
char arr[500];
int sum = 0;
int i = 0;
char c;
cin>>c;
while(c != '.'){
if(c >= 'A' && c <= 'Z'){
sum++;
}
arr[i] = c;
cin>>c;
}
cout<<sum;
return 0;
}