华为oj - 统计大写字母个数
练手而已。
给初学者参考
#include <stdio.h> #include <string.h> int main(void) { char string[200]={'\0'}; gets(string); int cnt = 0; if(string==NULL) { printf("0"); return 0; } for(int i = 0;i < strlen(string);i ++) { if(string[i]>='A'&&string[i]<='Z') { cnt++; } } printf("%d",cnt); return 0; }