【发布时间】:2021-06-04 05:42:20
【问题描述】:
所以标题说明了一切,我试图将 3 个单词列表连接在一起,但由于某种原因它不想阅读第 3 个列表,
第一个词表单词:
和
减号
第二个词表单词:
也没有
否定
第三个词表单词:
异或
加
void merge3(string MFile3)
{
string file1name, file2name,file3name, outfilename, word1, word2, word3;
cout << "Enter name of first file: ";
cin >> file1name;
cout << "Enter name of second file: ";
cin >> file2name;
cout << "Enter name of third file: ";
cin >> file3name;
cout << "Enter name of output file: ";
cin >> outfilename;
ofstream inFileFour(outfilename.c_str());
ifstream inFileOne(file1name.c_str());
while (inFileOne >> word1) {
ifstream inFileTwo(file2name.c_str());
while (inFileTwo >> word2) {
ifstream inFileThree(file2name.c_str());
while (inFileThree >> word3) {
inFileFour << word1 << word2 << word3 << endl;
}
inFileThree.close();
}
inFileTwo.close();
}
inFileOne.close();
inFileFour.close();
}
包含所有可能组合的单词列表,期望与文件
如果有人可以让我知道这里发生了什么,那就太好了,我愿意接受建议。
【问题讨论】:
-
见How to debug small programs,考虑与鸭子聊天,见What is a debugger and how can it help me diagnose problems?。能够单步调试代码并诊断错误与能够编写和编译代码一样重要。
-
非常有用!谢谢!