| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 665 人关注过本帖
标题:帮看程序中的一句什么意思;
只看楼主 加入收藏
kscooh1
Rank: 2
等 级:论坛游民
帖 子:53
专家分:25
注 册:2011-8-8
结帖率:90%
收藏
已结贴  问题点数:0 回复次数:1 
帮看程序中的一句什么意思;
程序如下:
程序代码:
void restricted_wc(ifstream &removeFile,map<string,int> &wordCount)
{
    vector<string> excluded;
    string removeWord;
    while(removeFile>>removeWord)  这括号中的是什么意思,书上都饿这么写的 ,没说明什么意思。看不懂
        excluded.push_back(removeWord);

    cout<<"Enter text(Ctrl+z to end):"<<endl;
    string word;
    while(cin>>word)
    {
        bool find=false;
        vector<string>::iterator iter=excluded.begin();
        while(iter!=excluded.end())
        {
            if(*iter==word)
            {
                find=true;
                break;
            }
            ++iter;
        }
        if(!find)
            ++wordCount[word];
    }
}

2011-10-19 15:05
tisyang
Rank: 8Rank: 8
等 级:蝙蝠侠
帖 子:132
专家分:737
注 册:2011-5-7
收藏
得分:20 
读取第一条“字面量“字符串存入变量removeWord 中
这里所谓的字面量是指 以空白符分隔的

C++ 用无参数构造函数生成对象时候请勿在构造函数后添加无用的那一对括号,否则有可能会被当成函数声明而忽略,嗯,栈上构建的时候就是这样。
2011-10-19 17:16
快速回复:帮看程序中的一句什么意思;
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011416 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved