还有些小BUG望共同完善
#include
#include
#include
typedef struct _datatype_ {
int coef;
int exp;
}datatype;
typedef struct _linklist_ {
datatype data;
struct _linklist_ *next;
}linknode;
linknode *creat_node(datatype data)
{
linknode *p = (linknode *)malloc(sizeof(linknode));
memset(p,0,sizeof(linknode));
p->data.coef = data.coef;
p->data.exp = data.exp;
return p;
}
void insert_data(linknode *head, datatype data)
{
linknode *new = NULL;
if(NULL == head)
return ;
new = creat_node(data);
while(head->next != NULL && head->next->data.exp < data.exp)
head = head->next;
new->next = head->next;
head->