本人c++萌新,对c++还不太熟悉。(已解决,谢谢大家)
参考信息:【mie haha 的博客】转载请注明出处(万分感谢!):
https://blog.csdn.net/qq_40315080/article/details/88176331
(调试照片以及txt文档)
(修改如下,具体原因可见我转载的文章)
读取函数如下:
void Class::class_Read() //从文件读入数据
{
Date *p;
p = ClassHead;
ifstream in("class.txt");
if (!in) { cout << "没有课程信息,请先录入课程信息!" << endl; return; }
while (1)
{
string n,e;
int s;
double N,t;
in >> N >> n >> t >> s >> e;
class_insert(N,n,t,s,e);
if(in.fail())
{
break;
}
}
in.close();
}
#endif;