展开全部
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int count;
char c;
char path[100];
char words[63]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r',
's','t','u','v','w','x','y','z',' '};
printf("请输入文件名:");//要带路径
scanf("%s",&path);
FILE * fb = NULL;
for(i = 0;i < 63; i++)
{
fb = fopen(path,"r");
if(NULL == fb)
return -1;
count = 0;
while(fscanf(fb,"%c",&c)!=EOF)
{
if(c == words[i])
{
count++;
}
}
printf("字符%c出现次数为:%d\n",words[i],count);
fclose(path);
}
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询