#include<stdio.h>
#include<stdlib.h>
typedef struct xiang *zz;
struct xiang{
int xi;
int zhi;
zz next;
};
zz read()
{
int count;
zz head=NULL,tail=NULL;
scanf("%d",&count);
while(count-->0){
zz newx=(zz)malloc(sizeof(struct xiang));
scanf("%d%d",&(newx->xi),&(newx->zhi));
newx->next=NULL;
if(!head){
head=newx;
tail=newx;
}
else{
tail->next=newx;
tail=tail->next;
}
}
return head;
}
zz add(zz dxs1 ,zz dxs2){
zz sum=NULL,tail=NULL,newn;
while(dxs1&&dxs2){
newn=(zz)malloc(sizeof(struct xiang));
if(dxs1->zhi>dxs2->zhi){
7-2 一元多项式的乘法与加法运算(20 分)
最新推荐文章于 2022-08-21 21:27:05 发布
这是一个实现一元多项式加法和乘法运算的C语言程序。程序通过结构体存储多项式项,使用链表数据结构进行操作。`read()`函数读取多项式,`add()`函数实现加法,`mul()`函数实现乘法,最后`print()`函数打印结果。
摘要由CSDN通过智能技术生成