2025-03-24 19:51:23 +08:00

20 lines
244 B
C

#include <stdio.h>
int main(){
FILE *fp;
char ch;
int count=0;
fp = fopen("letter.txt", "r");
while((ch=fgetc(fp)) != EOF){
if(ch == 'c'){
count++;
}
}
printf("c个数为:%d\n", count);
fclose(fp);//关闭文件指针
return 0;
}