我是新来的C++编程我有一个任务,它接受一个txt文件的内容,并用字典txt文件检查内容。当我的String []发送给我的功能,我总是得到其中规定的std ::基本的字符串不能转换为std ::〜应变C++使用字符串
ifstream d_file("dictionary.txt");
string l;
vector<string> user_vec;
while(getline(d_file, l)) {
user_vec.push_back(l);
}
size_t line_count = user_vec.size();
for(size_t i = 0; i < line_count; ++i)
{
// cout << i << " " << user_vec[i] << endl;
bool result = inDictionary(word, user_vec[i]);
}
}
bool inDictionary(string word,string dictionary[])
{
cout<<word<< dictionary<<endl;
}
没有投票,但太多副本! – 2013-04-09 00:04:50