![]() |
#2
tisyang2011-10-19 17:16
|

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];
}
}
{
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];
}
}