一、写文件
比如:
#include<iostream>
#include<fstream>
using namespace std;
//写文件
void test1()
{
//创建一个对象
ofstream ofs;
ofs.open("text.txt", ios::out);
ofs << "张三"<< endl;
ofs << "男" << endl;
ofs << "18" << endl;
ofs.close();
}
int main()
{
test1();
system("pause");
return 0;
}