#include<iostream>
using namespace std;
typedef struct LNode
{
int base;
int index;
struct LNode *next;
}LNode,*Polynomail;
void CreatePloyn(Polynomail &p,int m)
{
LNode *q,*qtail;
p=(LNode*)malloc(sizeof(LNode));
qtail=p;
int index,base;
cout<<"please input base=?,index=?"<<endl;
for(int i=1;i<=m;i++)
{
cin>>base>>index;
q=(LNode*)malloc(sizeof(LNode));
qtail->next=q;
q->base=base;
q->index=index;
q->next=NULL;
qtail=q;
}
}
void OutputPloyn(Polynomail p)
{
LNode* q;
q=p->next;
while(q->next)
{
cout<<q->base<<"X^"<<q->index<<"+";
q=q->next;
}
cout<<q->base<<"X^"<<q->index;
cout<<endl;
}
void AddPloyn(Polynomail &pa,Polynomail &pb)
- 1
- 2
前往页