degree.cpp

来自「This library defines basic operation on 」· C++ 代码 · 共 24 行

CPP
24
字号
// degree.cpp : Shows use of degree()
//
#include <iostream>
#include <polynomial.h>

using namespace std;

int main() {

    // Initialize p(x) = 5x^4 + 3x^2 + x + 10
    Polynomial<double> p(4, 10., 1., 3., 0., 5.);

    // Initialize q(x) = x^3 + x^2 - 5x + 2
    Polynomial<double> q(3, 2., -5., 1., 1.);

    //  Add p and q
    Polynomial<double> r = p + r;

    //  Display degree of new polynomial
    cout << "degree of r(x): " << r.degree() << endl;

    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?