用键盘输入一行字符,统计其中小写字母的个数,并将所有的小写字母转换成大写字母后,输出字符串
供参考:
#include <stdio.h>
int main()
{
int cnt=0,i=0;
char str[81];
scanf("%[^\n]", str);
while(str[i])
{
if (str[i] >= 'a' && str[i] <= 'z'){
cnt++;
str[i] -= 32;
}
i++;
}
printf("%s, lower:%d" ,str, cnt);
return 0;
}