c++中输出文件中的数字,并输出到链表

来源:互联网 发布:淘宝上哪家卖的芋圆好 编辑:程序博客网 时间:2024/05/21 17:17
int initial(linkpoint head,char* filename)
{
ifstream f(filename);
if (!f)
{
cout<<"文件打开错误"<<endl;
return 1;
}
int num;
data d;
f>>num;
if (num==0)
{
cout<<"多项式不存在"<<endl;
return 1;
}
while (num>0)
{
num--;
f>>d.factor;
f>>d.index;
   linklist_insert(head, d);
}
return 1;
}