用c语言编程,字符统计:输入一个文本文件,分别统计出其中英文字母、空格、数字和其它字符的个数
用c语言编程,字符统计:输入一个文本文件,分别统计出其中英文字母、空格、数字和其它字符的个数
日期:2019-07-09 11:34:09 人气:1
#include
int main()
{
char c;
int letters=0,space=0,digit=0,other=0;
printf("请输入一行字符:");
while ((c=getchar())!='\n')
{
if (c >= 'a'&&c = 'A'&&c <= 'Z')
{
letters++;
}
else if (c == ' ')
{
space+