Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::size_t nCoefficientsA;
- std::cout << "Number of <double> coefficients in the first vector: " << std::endl;
- std::cin >> nCoefficientsA;
- std::vector<double> coefficientsA;
- std::cout << "List of coefficients: " << std::endl;
- while (coefficientsA.size() < nCoefficientsA) {
- double coefficient;
- std::cin >> coefficient;
- coefficientsA.push_back(coefficient);
- }
- std::size_t nCoefficientsB;
- std::cout << "Number of <double> coefficients in the second vector: " << std::endl;
- std::cin >> nCoefficientsB;
- std::vector<double> coefficientsB;
- std::cout << "List of coefficients: " << std::endl;
- while (coefficientsB.size() < nCoefficientsB) {
- double coefficient;
- std::cin >> coefficient;
- coefficientsB.push_back(coefficient);
- }
- std::reverse(coefficientsA.begin(), coefficientsA.end());
- std::reverse(coefficientsB.begin(), coefficientsB.end());
- Polynomial<double> A(coefficientsA);
- Polynomial<double> B(coefficientsB);
- Polynomial<double> C(0);
- std::cout << "First vector: " << A << std::endl;
- std::cout << "Second vector: " << B << std::endl;
- std::cout << "Third vector: " << C << std::endl;
- if (A == B) {
- std::cout << "Equal" << std::endl;
- } else if (A != B) {
- std::cout << "Not Equal" << std::endl;
- }
- std::cout << "+ " << A + B << std::endl;
- std::cout << "- " << A - B << std::endl;
- std::cout << "/ : " << (A / B) << std::endl;
- std::cout << "% : " << (A % B) << std::endl;
- std::cout << ", : " << (A , B) << std::endl;
- std::cout << A(-1) << '\n';
- std::cout << "List of the coefficients before variable degrees from 0 to 19: " << std::endl;
- for (int i = 0; i < 20; ++i) {
- std::cout << A[i] << " ";
- }
- std::cout << std::endl;
- auto i = A.begin();
- while (i != A.end()) {
- std::cout << *i++ << " ";
- }
- std::cout << '\n';
- std::cout << A.Degree();
- std::cout << '\n';
- std::cout << *A.begin();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement