题目
输出字符串中的大写字母
思路(注意事项)
纯代码
#include<stdio.h>
#include<string.h>
int main(){
char str[20], ans[20];
fgets(str, sizeof(str), stdin);
str[strcspn(str, "\n")] = '\0';
for (int i = 0, j = 0; i < strlen(str); i ++){
if (str[i] >= 'A' && str[i] <= 'Z'){
ans[j ++] = str[i];
}
}
puts(ans);
return 0;
}