#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
typedef struct polynode
{
int coef; //多项式的系数
int exp; //指数
struct polynode *next;
}node;
node *create() //用尾插法建立一元多项式的链表
{
node *h,*r,*s;
int c,e;
h=(node*)malloc(sizeof(node));
r=h;
printf("coef:");
scanf("%d",&c);
printf("exp: ");
scanf("%d",&e);
while(c!=0) //输入系数为0时,多项式的输入结束
{
s=(node*)malloc(sizeof(node));
s->coef=c;
s->exp=e;
r->next=s;
r=s;
printf("coef:");
scanf("%d",&c);
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载