std::ofstream ofile; //定义输出文件
ofile.open("myfile.txt",std::iostream::app); //作为输出文件打开,在文件后添加内容
ofile<<" 公鸡 "<<std::endl; //标题写入文件
ofile.close(); //关闭文件
ofile.open("myfile.txt",std::iostream::app); //作为输出文件打开,在文件后添加内容
ofile<<" 公鸡 "<<std::endl; //标题写入文件
ofile.close(); //关闭文件