budui
供参考:
void solve()
{
FILE *fp;
char ch;
int cnt=0;
fp = fopen("a.txt","r");
if(fp == NULL){
printf("cann't open the file!\n");
return;
}
while (1){
ch = fgetc(fp);
if (ch == EOF) break;
if ((ch >= 'A' && ch <= 'Z')||(ch >= 'a' && ch <= 'z')) cnt++;
}
fclose(fp);
printf("Letters count:%d\n",cnt);
}