C语言英文txt文件统计段落数(开头空四格为一段落)

如题所述

#include
int main()
{
int c;
FILE *fp;
int t=0,m=0,n=0,b=0,c=0;
fp = fopen("in.txt","rb");
while((c = fgetc(fp)) != EOF)
if(c >='a'&&c ='A'&&c <='Z')
m++;
else if(c >='0'&&c <='9')
n++;
else if(c ==' ')
b++;
else
c++;
t = m+n+b+c;
printf("英文字母=%d, 数字=%d, 空格=%d, 其它字符=%d, 总字符=%d\n", m,n,b,c,t);
return 0;
}
温馨提示:答案为网友推荐,仅供参考
大家正在搜