Card Card::LoadFromFile(char *filename)
{
ifstream file;
int LEN;
file.open(filename, ios::in); // 只读
if (file.fail())
{
cout << "文件不存在." << endl;
file.close();
}
else//文件存在
{
LEN = CountLines(filename);
Card *card = new Card[LEN];
int i = 0;
while (!file.eof()) //读取数据到数组
{
file >> card[i].id >> card[i].money;
i++;
}
return *card;
}
}
一行是一个对象的数据
刚刚开始学c++,马上就要做一个银行管理系统,望指点
PS:这是我第一次提问,不足之处欢迎点出~