#include"cmath"
using namespace std;
template
struct Node
{
T data;
Node
};
struct element
{
double coef; int exp;
element(double c=0,int e=0):coef(c),exp(e){};
};
template
class LinkList
{
public:
//构造函数
Node
private:
Node
};
template
class PolyList:public LinkList
{
public:
PolyList( element data[],int n);
void Add(PolyList & B);
void PrintList()
{
Node
p->next;
while(p)
{
cout<<"("<
p = p->next;
}
cout<
};
template
void PolyList
{
Node
Node
Node
while(p&&q)
{
if(p->data.exp < q->data.exp)
{ p_prior = p; p = p->next; }
else if(p->data.exp > q->data.exp)
{ p_prior->next = q; p_prior = q; q = q->next; }
else
{
p->data.coef =q->data.coef;
if(fabs(p->data.coef)<1e-7)
{
p_prior->next = p->next;
delete p;
p_prior->next;
}
else
{
p_prior = p;
p = p_prior->next;
}
Node
q = q->next;
delete temp;
}
}
if(q)p_prior -> next = q; //第四种情况
B.GetFirst() -> next = NULL;
}
void main()
{
element ea[]={element(2,0),element(1.5,1),element(-2.3,2),element(5,4)} ;
element eb[]={element(2,1),element(-2.3,2),element(3.4,3),element(1.5,4),element(6,5)} ;
PolyList
a.Add(b);
a.PrintList();
}
编译没问题,链接时出现“ error LNK2001: unresolved external symbol "public: __thiscall PolyList
Debug/sam.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错”有哪位帮忙看下
谢谢啊,我改了后,编译链接都没问题,可是运行却出问题,是不是我这个程序本身有问题?谢谢了!实在很困惑。