您的位置:首页 > 其它

练习2-3:编一个程序用来打开文件并统计文件中以空格隔开的单词数目

2011-03-03 15:33 459 查看
#include<iostream>
#include<string>
#include<fstream>
using namespace std;

void main()
{
ifstream in("e://test.txt");
string word;
int num=0;
while(in>>word)
{
cout<<word<<" ";
num++;
}
cout<<endl<<num<<endl;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐