错误行: int LengC= A.length();
两个错误均在此行.
void main()
{
elem a[20], b[20];
int len_A, len_B;
printf("please input the length of the first LinkList");
cin>>len_A;
for(int i=0; i<len_A; i++)
{
cin>>a[i].coef>>a[i].exp;
}
LinkList<elem> A=LinkList<elem>(a, len_A);
cout<<endl<<"please input the length of the second LinkList"<<endl;
cin>>len_B;
for (int j = 0; j <len_B; j++)
{
cin>>b[j].coef>>b[j].exp;
}
LinkList<elem>B=LinkList<elem>(b, len_B);
Add(A, B);
int LengC= A.length();
elem elemCurrent;
for (int k = 1; k < LengC; k++)
{
elemCurrent=A.Get(k);
cout<<elemCurrent.coef<<"*x"<<elemCurrent.exp<<"+";
}
system("pause");
}
linklist类的定义呢?