用c语言打开文件,并统计里面的各种东西得个数

求求大佬帮忙,孩子快急哭了把啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊

#include <stdio.h>
int main()
{
 FILE *fp;
 int  num=0,others=0,chars=0;
 char ch;
 fp=fopen("data.txt","r");
 if(fp==NULL)
 {
    printf("Open file error!\n");
    exit (0);
 }
 while(1)
 {
    if(fscanf(fp,"%c",&ch) != 1) break;
    if(ch >= '0' && ch <= '9')
         num++;
    else if((ch >= 'A'&& ch <= 'Z')||(ch >= 'a'&& ch <= 'z'))
         chars++;
    else others++;
 }
 fclose(fp);
 printf("num:%d chars:%d others:%d\n",num,chars,others);
 return 0;
}

哪部分有困难啊?
fopen打开文件,fscanf、fread都可以读取文件数据啊

就是要读取文件,然后统计里面某个函数出现的次数吗?
参考如下: