#include <stdio.h>
#include <stdlib.h>
void main()
{
FILE *fp;
char ch;
int letter,digit,other;
letter=digit=other=0;
if((fp=fopen("a.txt","r"))==NULL){
printf("File open error!\n");
exit(0);
}
while(!feof(fp)){
ch=fgetc(fp);
if(ch>='A'&&ch<='Z'||ch>='a'&&ch<='z')
letter++;
else if(ch>='0'&&ch<='9')
digit++;
else
other++;
}
printf("letter=%d,digit=%d,other=%d\n",letter,digit,other);
}
Add a comment



连接两个链表
比较两个文件内容







