我已经制作了一个关于此的程序,该程序使用Dev C++CPP创建了很多文件,这个程序也使用 Dev C++ 但现在它显示错误。我的专业是创建模板,但它显示.codeHTMLerror
这是我的一些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();
}
Run Code Online (Sandbox Code Playgroud)
只需添加#include <fstream>到您的包含:
#include <iostream>
#include <fstream>
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();
}
int main()
{
HelloWorld();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出 :
Created Successfully! Directory: Program's folder
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5945 次 |
| 最近记录: |