这只是一个快速的问题。但我正在尝试将数据输出到一个文件,它工作正常。但是,我也试图在适当的点实现一个新行,以便数据打印在单独的行上。
这是我的代码当前的样子:
主文件
Writer w("Output.txt");
w.writeString("The number of words in the script are: ");
w.writeInt(count);
w.writeEol();
w.writeString("The number of Officers in the script are: ");
w.writeInt(ofCount);
w.writeEol();
w.writeString("The number of Courtiers in the script are: ");
w.writeInt(cCount);
w.close();
编写器.cpp
void Writer::writeEol()
{
out << "\n" << endl;
}
我的代码必须以这种方式实现,因为我的整个系统都是围绕它构建的。
所以我的问题是,我将如何调整我的 Writer::writeEol() 以在我的输出文件中添加一个新行?
我的输出文件目前是这样的:
The number of words in the script are: 32339The number of Officers in the script are: 2The number of Courtiers in the script are: 9
任何帮助是极大的赞赏。:)