本文整理汇总了C++中Polynomial::GetPower方法的典型用法代码示例。如果您正苦于以下问题:C++ Polynomial::GetPower方法的具体用法?C++ Polynomial::GetPower怎么用?C++ Polynomial::GetPower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polynomial
的用法示例。
在下文中一共展示了Polynomial::GetPower方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
vector<int> a;
for (int i = 1; i < 5; ++i) {
a.push_back(i);
}
vector<int> b;
for (int i = 0; i < 7; ++i) {
int value = 4 - i;
b.push_back(value);
}
Polynomial<int> A(a);
Polynomial<int> B(b);
cout << "A = " << A << '\n' << "B = " << B << '\n';
Polynomial<int> C;
cout << "NULL Polynomial: " << C << " Power: " << C.GetPower() << '\n';
C = A + B;
cout << "A + B = " << C << '\n';
C = A - B;
cout << "A - B = " << C << '\n';
C = 0;
cout << "C = 0 <=> C: " << C << '\n';
C += A;
cout << "C += A: " << C << '\n';
C -= B;
cout << "C -= B: " << C << '\n';
C += 7;
cout << "C += 7: " << C << '\n';
C -= 4;
cout << "C -= 4: " << C << '\n';
C *= 5;
cout << "C *= 5: " << C << '\n';
C /= 5;
cout << "C /= 5: " << C << '\n';
C %= 3;
cout << "C %= 3: " << C << '\n';
C = A * 0;
cout << "C = A * 0: " << C << '\n';
try {
C = A / 0;
} catch (Polynomial<>::DivisionByZeroException e) {
cout << "C = A / 0: Div by Zero exception!\n";
}
C = A * B;
cout << "C = A * B: " << C << '\n';
cout << "\n\n NEW PolynomialS INCLUDED: \n";
vector<int> d;
d.push_back(1); d.push_back(2); d.push_back(2); d.push_back(1);
vector<int> f;
f.push_back(-2); f.push_back(-2); f.push_back(-1); f.push_back(1); f.push_back(1);
vector<int> g;
g.push_back(1); g.push_back(2); g.push_back(3); g.push_back(4); g.push_back(5); g.push_back(6);
vector<int> h;
h.push_back(-1); h.push_back(1); h.push_back(3); h.push_back(5); h.push_back(7); h.push_back(9);
vector<int> k;
k.push_back(-1); k.push_back(-1); k.push_back(1); k.push_back(1);
vector<int> z;
z.push_back(1); z.push_back(1);
vector<int> l;
l.push_back(-2); l.push_back(10); l.push_back(12); l.push_back(-5); l.push_back(1); l.push_back(2);
vector<int> m;
m.push_back(7); m.push_back(-2); m.push_back(0); m.push_back(1);
vector<int> n;
n.push_back(-8); n.push_back(-4); n.push_back(2); n.push_back(5); n.push_back(2); n.push_back(-4); n.push_back(1);
vector<int> p;
p.push_back(-4); p.push_back(-4); p.push_back(1); p.push_back(-1); p.push_back(-1); p.push_back(1);
Polynomial<int> D(d); cout << "D: " << D << '\n';
Polynomial<int> F(f); cout << "F: " << F << '\n';
Polynomial<int> G(g); cout << "G: " << G << '\n';
Polynomial<int> H(h); cout << "H: " << H << '\n';
Polynomial<int> K(k); cout << "K: " << K << '\n';
Polynomial<int> Z(z); cout << "Z: " << Z << '\n';
Polynomial<int> L(l); cout << "L: " << L << '\n';
Polynomial<int> M(m); cout << "M: " << M << '\n';
Polynomial<int> N(n); cout << "N: " << N << '\n';
Polynomial<int> P(p); cout << "P: " << P << '\n';
cout << "\n\n START CALCULATIONS\n";
C = (D, F);
cout << "C = GCD(D, F): " << C << '\n';
C = H / G;
cout << "C = H / G: " << C << '\n';
C = K / Z;
cout << "C = K / Z: " << C << '\n';
C = (L, M);
cout << "MUTUAL PRIME: C = GCD(L, M): " << C << '\n';
C = (P, N);
cout << "Inverse order: C = GCD(P, N): " << C << '\n';
C = F % D;
cout << "C = F % D: " << C << '\n';
C = N % P;
cout << "C = N % P: " << C << '\n';
C = P % (N % P);
cout << "C = P % (N % P): " << C << '\n';
C = 108;
C %= P;
cout << "108 % P: " << C << '\n';
C = 108;
C /= P;
cout << "108 / P: " << C << '\n';
//.........这里部分代码省略.........