帮帮我解决下C语言题目啊 谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/22 20:41:42
编写一个程序,使用函数统计一串字符中小写字母的个数,该函数参数为一个字符数组,返回值为小写字母的个数.在主函数中键盘接受一串字符,并调用统计函数求出小写字母的个数,然后输出

#include <stdio.h>

int count(char *str)
{
int ans=0;
while (*str)
{
if (*str>='a' && *str<='z') ans++;
str++;
}
return ans;
}

char line[1000];
main()
{
gets(line);
printf("%d\n",count(line));
}

……别逼我,这也问??