int Count(int cou[]) //计算输入的字母的个数
{
char word;
char letter[27]={' ','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'};
fstream SourceFile;
SourceFile.open("SourceFile.txt",ios::in);
if (!SourceFile)
{
cout<<"Can't open this file"<<endl;
}
while (!SourceFile.eof())
{
SourceFile.get(word);
if (word>='A'&&word<='Z')
{
word=word+32;
}
int i=word-96;
cou[i]++;
}
SourceFile.close();
cout<<"letter"<<'\t'<<'\t'<<"频率为"<<endl;
for (int j=1;j<=26;j++)
{
if (cou[j]!=0)
{
cout<<letter[j]<<'\t'<<'\t'<<cou[j]<<endl;
}
}
cout<<"读入完事儿!"<<endl;
return 0;
}