void SaveData(tList *tListGue) //保存数据
{
int i = 0;
ofstream ofile("Guestroom.txt", ios_base::out); //创建一个输入文件流对象
if (!ofile)
{
cerr << "保存时打开文件出错!" << endl;
}
cNode *p;
p = tListGue->head->next;
while (p)
{
//从内存中读取数据,存到外盘
if (p->data.flag)
{
ofile << "\n";
ofile << (p->data).ID << "\n";
ofile << (p->data).Type << "\n";
ofile << (p->data).Book << "\n";
ofile << (p->data).Price << "\n";
ofile << (p->data).Function << "\n";
ofile << (p->data).StayTime << "\n";
}
}
cout << "保存数据成功!\n";
ofile.close();
system("pause");
system("cls");
return;