我是新來的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