题目描述
算算以‘.’结束的一串字符中含有多少个大写的英文字母。
输入
输入一串字符,以.结束
输出
输出一行,即这串字符中大写字母的个数。
样例输入
PRC,PRC,I'm from China.
样例输出
8
代码
#include<iostream>
using namespace std;
int getNum(char *s){
int c=0;
while(*s!='\0'){
if(*s>='A'&&*s<='Z'){
c++;
}
s++;
}
return c;
}
int main(){
char s[100];
cin.getline(s,100);
int c=getNum(s);
cout<<c<<endl;
}