#include<stdio.h>
#include<string.h>
int Count[87][94];
int isChinese(int ch1,int ch2)
{
if((ch1>=0xa1&&ch1<=0xfe)&&(ch2>=0xa1&&ch2<=0xfe))
return 1;
else return 0;
}
int main()
{
FILE *pf;
unsigned int ch1,ch2;
memset(Count,0,sizeof(Count));
pf=fopen("as.txt","rt");
while(((ch1=fgetc(pf))!=EOF&&(ch2=fgetc(pf))!=EOF))
{
if (isChinese(ch1,ch2))
{
Count[ch1-0xa1][ch2-0xa1]++;
}else fseek(pf,-1,SEEK_CUR);//文件读写的定位
}
for(ch1=0;ch1<87;ch1++)
{
for(ch2=0;ch2<94;ch2++)
{
if(Count[ch1][ch2])
printf("%c%c:%d\n",ch1+0xa1,ch2+0xa1,Count[ch1][ch2]);
} }
return 1;
}
#include<string.h>
int Count[87][94];
int isChinese(int ch1,int ch2)
{
if((ch1>=0xa1&&ch1<=0xfe)&&(ch2>=0xa1&&ch2<=0xfe))
return 1;
else return 0;
}
int main()
{
FILE *pf;
unsigned int ch1,ch2;
memset(Count,0,sizeof(Count));
pf=fopen("as.txt","rt");
while(((ch1=fgetc(pf))!=EOF&&(ch2=fgetc(pf))!=EOF))
{
if (isChinese(ch1,ch2))
{
Count[ch1-0xa1][ch2-0xa1]++;
}else fseek(pf,-1,SEEK_CUR);//文件读写的定位
}
for(ch1=0;ch1<87;ch1++)
{
for(ch2=0;ch2<94;ch2++)
{
if(Count[ch1][ch2])
printf("%c%c:%d\n",ch1+0xa1,ch2+0xa1,Count[ch1][ch2]);
} }
return 1;
}