文件名称:Polynomial
介绍说明--下载内容均来自于网络,请自行研究使用
一个d阶多项式有如下形式:
cdxd+cd− 1xd− 1+cd− 2xd− 2…+c0
其中,cd≠0,指数都是非负数。每一个cixi是多项式中的一项。
设计一个C++的模板类 Polynomial<T>,T给出系数的类型,要求能够实现多项式的表示和运算。Polynomial类应该包括私有变量degree,和其他需要的变量。对多项式的表示要求用线性表的形式,例如(c0,c1,c2,…,cd)表示系数表。并设计以下成员函数和操作:
(a) Polynomial(),创建零阶多项式,即构造函数
(b) Degree(),返回多项式的阶数degree
(c) Input(),输入多项式,指数升序依次输入每一项的指数和系数。例如输入: 0 c0 1 c1 2 c2…d cd。重载>>完成输入。
(d) Output(),输出多项式,和输入的格式相同。重载<<完成输出。
(e) Add(b),和b多项式相加,并返回结果多项式。重载+。
(f) Subtract(b),和b多项式相减返回结果多项式。重载-。
(g) Multiply(b),和b多项式相乘返回结果多项式。重载*。
(h) Value(x),返回x代入多项式的值。重载( ),例如对于多项式对象P, P(x)能够返回代入x的多项式值。
-A d-order polynomial has the following form:
cdxd+ cd-1xd-1+ cd-2xd-2 ...+ c0
Which, cd ≠ 0, index are non-negative. In each one of the polynomial cixi.
Design template a C++ class Polynomial <T>, T given coefficient type, the request can be realized and computing polynomial representation. Polynomial class should include the private variable degree, and other variables needed. Requires the polynomial representation of the linear form of tables, such as (c0, c1, c2, ..., cd) represents the coefficient table. And to design and operate the following member functions:
(a) Polynomial (), to create the zero-order polynomial, the constructor
(b) Degree (), return to the order of the polynomial degree
(c) Input (), the input polynomial, exponential in the ascending order of the index and enter each one factor. For example, enter: 0 c0 1 c1 2 c2 ... d cd. Overloaded >> complete the entry.
(d) Output (), output of the polynomial, and input the same format. Overloaded <<
cdxd+cd− 1xd− 1+cd− 2xd− 2…+c0
其中,cd≠0,指数都是非负数。每一个cixi是多项式中的一项。
设计一个C++的模板类 Polynomial<T>,T给出系数的类型,要求能够实现多项式的表示和运算。Polynomial类应该包括私有变量degree,和其他需要的变量。对多项式的表示要求用线性表的形式,例如(c0,c1,c2,…,cd)表示系数表。并设计以下成员函数和操作:
(a) Polynomial(),创建零阶多项式,即构造函数
(b) Degree(),返回多项式的阶数degree
(c) Input(),输入多项式,指数升序依次输入每一项的指数和系数。例如输入: 0 c0 1 c1 2 c2…d cd。重载>>完成输入。
(d) Output(),输出多项式,和输入的格式相同。重载<<完成输出。
(e) Add(b),和b多项式相加,并返回结果多项式。重载+。
(f) Subtract(b),和b多项式相减返回结果多项式。重载-。
(g) Multiply(b),和b多项式相乘返回结果多项式。重载*。
(h) Value(x),返回x代入多项式的值。重载( ),例如对于多项式对象P, P(x)能够返回代入x的多项式值。
-A d-order polynomial has the following form:
cdxd+ cd-1xd-1+ cd-2xd-2 ...+ c0
Which, cd ≠ 0, index are non-negative. In each one of the polynomial cixi.
Design template a C++ class Polynomial <T>, T given coefficient type, the request can be realized and computing polynomial representation. Polynomial class should include the private variable degree, and other variables needed. Requires the polynomial representation of the linear form of tables, such as (c0, c1, c2, ..., cd) represents the coefficient table. And to design and operate the following member functions:
(a) Polynomial (), to create the zero-order polynomial, the constructor
(b) Degree (), return to the order of the polynomial degree
(c) Input (), the input polynomial, exponential in the ascending order of the index and enter each one factor. For example, enter: 0 c0 1 c1 2 c2 ... d cd. Overloaded >> complete the entry.
(d) Output (), output of the polynomial, and input the same format. Overloaded <<
(系统自动生成,下载前可以参看下载内容)
下载文件列表
DOC
...\week03.docx
...\week03.pdf
...\理论课作业 P127.doc
EXE
...\week03.exe
SRC
...\week03.cpp
...\week03.h