终极11吧 关注:163贴子:4,987
  • 1回复贴,共1

存代码的程序猿路过

只看楼主收藏回复

#include<fstream>
#include<iostream>
#include<string>
#include<map>
int main(int argc;char** argv)
{
map<string,int>m;ifstream fin(argv[1]);
string s;
while(fin>>s)
if(s[0]>='a'&&s[0]<='z'||s[0]>='A'&&s[0]<='Z')
m[s]++;
for each(auto elew in m)
cout<<elem.first<<":"<<elem.second<<"\n";
return 0;
}
/*本程序用于统计文件中每个单词的出现次数*/


IP属地:广东1楼2013-04-11 16:16回复
    很好....


    2楼2013-04-13 09:29
    回复