【发布时间】:2018-10-25 13:52:51
【问题描述】:
我已经为此编写了一个CPP 程序,它使用Dev C++ 创建了很多文件,这个也是使用Dev C++ 的,但现在它显示错误。我的code 专门用于创建HTML 模板,但它显示error。
这是我的一些code:
#include <iostream>
using std::cout;
using std::cin;
using std::ofstream;
using std::endl;
void HelloWorld() {
ofstream outfile ("html1.html");
outfile << "<html> " << endl;
outfile << " <head> <title> Template Hello World </title> </head>" << endl;
outfile << " <body> <h1> Hello World! </h1> </body> " << endl;
outfile << "</html> " << endl;
outfile << "// Template HTML 2018 " << endl;
cout << "Created Succesfuly! Directory: Program's folder " << endl;
outfile.close();
}
【问题讨论】:
-
您忘记包含 ostream 或 ofstream 或 wtv
-
试试
#include <fstream>。 -
感谢两位。那行得通。我是 C++ 的初学者,所以
-
@SpanishMapping 如果你是初学者,你应该向good C++ book学习,而不是随机编码。
-
@AlgirdasPreidžius 谁说这是随机的?