我有一个循环,要求无限次输入数据,但问题是txt文件仅存储输入数据之一 如果需要更多代码,请添加注释,只是我是C ++新手
void printwine(Wine1 wine) { //data the user typed as output
ofstream file_;
file_.open("wine.txt");
file_ << "Wine" << endl;
file_ << "the name is: " << wine.name << endl;
file_ << "it's year is: " << wine.year << endl;;
file_ << "its country of creation is: " << wine.place << endl;;
file_ << "it's price is: " << wine.price << endl;
file_.close();
}