#include <stdio.h>
#include <stdlib.h>
int main()
{int a[128]={0},i;
FILE *fp;
char c;
if((fp=fopen("d:\\0.c","r"))==NULL)
{printf("指定的文件未找到!\n");
return 0;
}
while((c=fgetc(fp))!=EOF)
if(c>='a'&&c<='z'||c>='A'&&c<='Z')
a[c]++;
for(i='A';i<='Z';i++)
{if(a[i])printf("%c: %d\t",i,a[i]);
else if(a[i+32])printf("\t");
if(a[i+32])printf("%c: %d\n",i+32,a[i+32]);
}
return 0;
}
温馨提示:答案为网友推荐,仅供参考