1樓:闊氣剋剋
寫個示例輸入看看啊,不知道你輸入是什麼格式。
c語言程式題:編寫程式實現多項式計算
2樓:匿名使用者
#include
#include
#include
#define eps 1e-6
typedef struct item *polynomial,*pitem;
polynomial create()
p->next = null;
return head;
}void sort(polynomial head)
else q = q->next;
}p = p->next;}}
void show(polynomial head)
else if(p->coefficient == 1.0) printf("x^%d ",p->power);
else if(p->coefficient == -1.0) printf("-x^%d ",p->power);
else printf("%.2lfx^%d ",p->coefficient,p->power);
flag = 0;}}
else if(p->coefficient > 0.0 && fabs(p->coefficient) >= eps)
else if(p->coefficient == 1.0) printf("+ x^%d ",p->power);
else printf("+ %.2lfx^%d ",p->coefficient,p->power);
}else if(p->coefficient < 0.0 && fabs(p->coefficient) >= eps)
else if(p->coefficient == -1.0) printf("- x^%d ",p->power);
else printf("- %.2lfx^%d ",-p->coefficient,p->power);
}p = p->next;
}printf("\n");
}double power(double x,int n)
double value(polynomial head,double x)
polynomial copy(polynomial a)
t->next = null;
return head;
}polynomial additive(polynomial a, polynomial b)
break;
}q = q->next;
}if(q->next == null)
}sort(head);
return head;
}polynomial subtract(polynomial a, polynomial b)
break;
}q = q->next;
}if(q->next == null)
}sort(head);
return head;
}polynomial multiplication(polynomial a, polynomial b)
}t->next = null;
sort(head); // 排序
p = head;
while(p->next)
else q = q->next;
}p = p->next;
}return head;
}void freememory(polynomial head)
}int main()
c語言程式設計計算並輸出下列多項式的值fm
include double fac int n int main int i,m double s 0 scanf d m for i 0 i c語言程式 編寫一個函式,計算並輸出下列多項式的值 s 1 1 1 1 2 3 3 1 n include void fun int n include ...
編寫程式用單連結串列儲存多項式,並實現兩個多項式相加的函式
多項式加法和乘法示例 include include include using namespace std 定義多項式的項類 class term 定義多項式類 class polyarith else if t second.exp t first.exp else 該for迴圈針對第一個多項式...
用c語言寫輸入兩個整數ab程式設計求解a的b次冪的
include include include include include include include using namespace std string highit string a,string b c for int i n m 1 i 0 i result.insert 0,1,...