Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.83 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. struct node {
  6.     int deg = 0;
  7.     double koef = 0;
  8.     node* next = nullptr;
  9.     node* prev = nullptr;
  10. };
  11.  
  12. struct polynomial {
  13.     node* poly;
  14.     polynomial* next = nullptr;
  15. };
  16.  
  17.  
  18. pair<int, int> read_koef(int i, string &main_str) {
  19.     char c = main_str[i];
  20.     int koef = 0;
  21.  
  22.     while('0' <= c && c <= '9') {
  23.         koef *= 10;
  24.         koef += (int) (c - '0');
  25.         c = main_str[++i];
  26.     }
  27.  
  28.     if (koef == 0 && main_str[i - 1] != '0') return {1, i};
  29.  
  30.     return {koef, i};
  31. }
  32.  
  33. pair<string, int> read_name(int i, string &main_str) {
  34.     char c = main_str[i];
  35.     string dname = "";
  36.  
  37.     while( ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') ) {
  38.         dname += c;
  39.         ++i;
  40.         c = main_str[i];
  41.     }
  42.  
  43.     return {dname, i};
  44. }
  45.  
  46. pair<int, int> read_deg(int i, string &main_str) {
  47.     char c = main_str[i];
  48.  
  49.     if (c != '^') return {1, i};
  50.  
  51.     if (c == '^') {
  52.         c = main_str[++i];
  53.     }
  54.  
  55.     if (!('0' <= c && c <= '9') ) return {-1, i};
  56.  
  57.     int deg = 0;
  58.     while('0' <= c && c <= '9') {
  59.         deg *= 10;
  60.         deg += (int) (c - '0');
  61.         c = main_str[++i];
  62.     }
  63.  
  64.     return {deg, i};
  65. }
  66.  
  67. pair<string, int> read_sign(int i, string &main_str) {
  68.     if (main_str[i] != '+' && main_str[i] != '-' && i == 0) {
  69.         return {"+", i};
  70.     }
  71.  
  72.     char c = main_str[i];
  73.     string sg;
  74.  
  75.     sg = c;
  76.  
  77.     return {sg, i + 1};
  78. }
  79.  
  80. bool sign_bool(char c) {
  81.     if (c == '-') return 1;
  82.     if (c == '+') return 1;
  83.     if (c == '^') return 1;
  84.     if (c == '*') return 1;
  85.     return 0;
  86. }
  87.  
  88. void create_node(node* &h, int koef, int deg) {
  89.     h->deg = deg;
  90.     h->koef = koef;
  91.     h->next = nullptr;
  92.     h->prev = nullptr;
  93.     return;
  94. }
  95.  
  96. void add_node(node* &head, int koef, int deg){
  97.     if (koef == 0) return;
  98.     if (head->prev == nullptr) {
  99.         node* h = new (node);
  100.         create_node(h, koef, deg);
  101.         head->prev = h;
  102.         h->next = head;
  103.         return;
  104.     }
  105.  
  106.     node* p = head->prev;
  107.     node* h = new (node);
  108.     create_node(h, koef, deg);
  109.  
  110.     if (p->deg < h->deg) {
  111.         p->next = h;
  112.         h->prev = p;
  113.         h->next = head;
  114.         head->prev = h;
  115.         return;
  116.     }
  117.  
  118.     while (p->prev != nullptr && p->deg > h->deg) {
  119.         p = p->prev;
  120.     }
  121.  
  122.     if (h->deg > p->deg) {
  123.         p->next->prev = h;
  124.         h->next = p->next;
  125.         h->prev = p;
  126.         p->next = h;
  127.         return;
  128.     }
  129.     if (p->deg == h->deg) {
  130.         if (p->koef + h->koef == 0) {
  131.             if (p->prev == nullptr) {
  132.                 p->next->prev = nullptr;
  133.                 delete p;
  134.             }
  135.             else {
  136.                 p->next->prev = p->prev;
  137.                 p->prev->next = p->next;
  138.                 delete p;
  139.             }
  140.         }
  141.         else p->koef += h->koef;
  142.         delete h;
  143.         return;
  144.     }
  145.     if (h->deg < p->deg) {
  146.         p->prev = h;
  147.         h->next = p;
  148.         return;
  149.     }
  150. }
  151.  
  152. void print_node(node* head) {
  153.     node *p = head->prev;
  154.  
  155.     //if (name == "") name = "x";
  156.     string name = "x";
  157.  
  158.     if (p == nullptr) {
  159.         cout << 0 << endl;
  160.         return;
  161.     }
  162.  
  163.  
  164.     if (p->deg == 0) {
  165.         cout << p->koef;
  166.         p = p->prev;
  167.     }
  168.     else {
  169.         if (p->deg == 1) {
  170.             if (p->koef == -1) {
  171.                 cout << "-";
  172.             }
  173.             else cout << p->koef;
  174.             cout << name;
  175.         }
  176.         else {
  177.             if (p->koef == -1) {
  178.                 cout << "-";
  179.             }
  180.             else cout << p->koef;
  181.             cout << name << "^" << p->deg;
  182.         }
  183.  
  184.         p = p->prev;
  185.     }
  186.  
  187.     while(p != nullptr) {
  188.         if (p->koef == 1) {
  189.             if (p->deg == 0) {
  190.                 cout << "+" << p->koef;
  191.             }
  192.             else cout << "+" << name << "^" << p->deg;
  193.             p = p->prev;
  194.             continue;
  195.         }
  196.         if (p->koef == -1) {
  197.             if (p->deg == 0) {
  198.                 cout << "-" << p->koef;
  199.             }
  200.             else cout << "-" << name << "^" << p->deg;
  201.             p = p->prev;
  202.             continue;
  203.         }
  204.  
  205.  
  206.         if (p->koef > 0) cout << "+";
  207.         if (p->deg == 0) {
  208.             cout << p->koef;
  209.         }
  210.         else if (p->deg == 1) {
  211.             cout << p->koef << name;
  212.         }
  213.         else {
  214.             cout << p->koef << name << "^" << p->deg;
  215.         }
  216.         p = p->prev;
  217.     }
  218.         cout << endl;
  219. }
  220.  
  221. void print_node_prev(node* head) {
  222.     node *p = head;
  223.  
  224.     //if (name == "") name = "x";
  225.     string name = "x";
  226.  
  227.     if (p == nullptr) {
  228.         cout << 0 << endl;
  229.         return;
  230.     }
  231.  
  232.  
  233.     if (p->deg == 0) {
  234.         cout << p->koef;
  235.         p = p->prev;
  236.     }
  237.     else {
  238.         if (p->deg == 1) {
  239.             if (p->koef == -1) {
  240.                 cout << "-";
  241.             }
  242.             else cout << p->koef;
  243.             cout << name;
  244.         }
  245.         else {
  246.             if (p->koef == -1) {
  247.                 cout << "-";
  248.             }
  249.             else cout << p->koef;
  250.             cout << name << "^" << p->deg;
  251.         }
  252.  
  253.         p = p->prev;
  254.     }
  255.  
  256.     while(p != nullptr) {
  257.         if (p->koef == 1) {
  258.             if (p->deg == 0) {
  259.                 cout << "+" << p->koef;
  260.             }
  261.             else cout << "+" << name << "^" << p->deg;
  262.             p = p->prev;
  263.             continue;
  264.         }
  265.         if (p->koef == -1) {
  266.             if (p->deg == 0) {
  267.                 cout << "-" << p->koef;
  268.             }
  269.             else cout << "-" << name << "^" << p->deg;
  270.             p = p->prev;
  271.             continue;
  272.         }
  273.  
  274.  
  275.         if (p->koef > 0) cout << "+";
  276.         if (p->deg == 0) {
  277.             cout << p->koef;
  278.         }
  279.         else if (p->deg == 1) {
  280.             cout << p->koef << name;
  281.         }
  282.         else {
  283.             cout << p->koef << name << "^" << p->deg;
  284.         }
  285.         p = p->prev;
  286.     }
  287.         cout << endl;
  288. }
  289.  
  290.  
  291. node* pol(string &main_str) {
  292.     bool turn;
  293.     string name = "";
  294.     for (int i = 0; i < main_str.size(); i++) {
  295.         if (!( ('0'<=main_str[i]&&main_str[i]<='9') || ('a'<=main_str[i]&&main_str[i]<='z') ||
  296.                ('A'<=main_str[i]&&main_str[i]<='Z') || main_str[i] == '^' ||
  297.                  main_str[i] == '+' || main_str[i] == '-' || main_str[i] == ' ')) {
  298.                 cout << "ERROR1!!!" << endl;
  299.                 main_str = "";
  300.                 name = "";
  301.                 return nullptr;
  302.              }
  303.     }
  304.  
  305.     for(int i = 0; i < main_str.size(); i++) {
  306.         if(main_str[i] == '*') {
  307.             main_str.erase(i, 1);
  308.             i--;
  309.         }
  310.     }
  311.  
  312.     for (int i = 0; i < main_str.size(); i++) {
  313.         if (i == 0) {
  314.             if (('a'<=main_str[i]&&main_str[i]<='z') || ('A'<=main_str[i]&&main_str[i]<='Z')) turn = 1;
  315.             else turn = 0;
  316.         }
  317.         else {
  318.             if ( ('a'<=main_str[i]&&main_str[i]<='z' || 'A'<=main_str[i]&&main_str[i]<='Z') &&
  319.                 !('a'<=main_str[i - 1]&&main_str[i - 1]<='z' || 'A'<=main_str[i - 1]&&main_str[i- 1]<='Z') ) {
  320.                 if (turn == 1) {
  321.                     cout << "ERROR2!!!" << endl;
  322.                     main_str = "";
  323.                     name = "";
  324.                     return nullptr;
  325.                 }
  326.                 turn = 0;
  327.             }
  328.             else if (main_str[i] != ' ') {
  329.                 turn = 0;
  330.             }
  331.         }
  332.     }
  333.  
  334.     for(int i = 0; i < main_str.size(); i++) {
  335.             if(main_str[i] == ' ') {
  336.                     main_str.erase(i, 1);
  337.                     i--;
  338.             }
  339.         }
  340.  
  341.     if (main_str.size() == 0) {
  342.         cout << "ERROR3!!!" << endl;
  343.         main_str = "";
  344.         name = "";
  345.         return nullptr;
  346.     }
  347.  
  348.  
  349.     for (int i = 0; i < main_str.size(); i++) {
  350.  
  351.         if (i != 0 && sign_bool(main_str[i]) && sign_bool(main_str[i - 1])) {
  352.             cout << "ERROR4!!!" << endl;
  353.             main_str = "";
  354.             name = "";
  355.             return nullptr;
  356.         }
  357.  
  358.         if (i != 0 && ('0'<=main_str[i]&&main_str[i]<='9') && (('a'<=main_str[i - 1]&&main_str[i - 1]<='z') ||
  359.                ('A'<=main_str[i - 1]&&main_str[i - 1]<='Z')) ) {
  360.             cout << "ERROR4!!!" << endl;
  361.             main_str = "";
  362.             name = "";
  363.             return nullptr;
  364.         }
  365.  
  366.         if (i != 1 && ('0'<=main_str[i - 2]&&main_str[i - 2]<='9') && main_str[i - 1] == '^' && ('0'<=main_str[i]&&main_str[i]<='9') ) {
  367.             cout << "ERROR4!!!" << endl;
  368.             main_str = "";
  369.             name = "";
  370.             return nullptr;
  371.         }
  372.  
  373.     }
  374.  
  375.     if (main_str.size() == 0 || (main_str.size() == 1 && sign_bool(main_str[0]))) {
  376.         cout << "ERROR5!!!" << endl;
  377.         main_str = "";
  378.         name = "";
  379.         return nullptr;
  380.     }
  381.  
  382.     //cout << main_str << endl << endl;
  383.  
  384.     node *head = new(node);
  385.  
  386.  
  387.     for (int i = 0; i < main_str.size();) {
  388.         int koef, deg;
  389.         string dname, sg = " ";
  390.         auto d1 = read_sign(i, main_str);
  391.         sg = d1.first;
  392.         i = d1.second;
  393.         auto d2 = read_koef(i, main_str);
  394.         koef = d2.first;
  395.         i = d2.second;
  396.         auto d3 = read_name(i, main_str);
  397.         dname = d3.first;
  398.         i = d3.second;
  399.         auto d4 = read_deg(i, main_str);
  400.         deg = d4.first;
  401.         i = d4.second;
  402.         if (dname == "") {
  403.             deg = 0;
  404.         }
  405.         if (deg < 0) {
  406.             cout << "ERROR4!!!" << endl;
  407.             main_str = "";
  408.             name = "";
  409.             return nullptr;
  410.         }
  411.         if (sg != "-" && sg != "+") {
  412.             cout << "ERROR5!!!" << endl;
  413.             main_str = "";
  414.             name = "";
  415.             return nullptr;
  416.         }
  417.         //cout << sg << " " << koef << dname << "^" << deg << endl;
  418.         if (sg == "-") koef = -koef;
  419.         if (name == "") {
  420.             name = dname;
  421.         }
  422.         else if (dname != name && dname != "") {
  423.             cout << "ERROR6!!!" << endl;
  424.             main_str = "";
  425.             name = "";
  426.             return nullptr;
  427.         }
  428.         add_node(head, koef, deg);
  429.     }
  430.  
  431.     print_node(head);
  432.     name = "";
  433.  
  434.  
  435.     return head;
  436. }
  437.  
  438. //#########################
  439.  
  440. void ins_after(int d,double k,node* &p,bool x) {
  441.     node *q = new node;
  442.     q->deg = d;
  443.     q->koef = k;
  444.     if (x) {
  445.         p->prev = q;
  446.         q->next = p;
  447.     } else
  448.         q->next = nullptr;
  449.     p = q;
  450. }
  451.  
  452. node* poly_num(polynomial* HEAD, int k) {
  453.     polynomial *h = HEAD;
  454.     node *L;
  455.     for (int i = 0; i < k; i++)
  456.         h = h->next;
  457.     L = h->poly;
  458.     return L;
  459. }
  460.  
  461. node* sum(node* L1,node* L2) {
  462.     node *head = new node;
  463.  
  464.     if (L1->prev != nullptr) {
  465.         node *p = L1->prev;
  466.         while (p != nullptr) {
  467.             add_node(head, p->koef, p->deg);
  468.             p = p->prev;
  469.         }
  470.         delete p;
  471.     }
  472.  
  473.     if (L2->prev != nullptr) {
  474.         node *p = L2->prev;
  475.         while (p != nullptr) {
  476.             add_node(head, p->koef, p->deg);
  477.             p = p->prev;
  478.         }
  479.         delete p;
  480.     }
  481.  
  482.     return head;
  483. }
  484.  
  485. node* derivative(node* L, int n) {
  486.     node *dL = new node;
  487.     node *p = L->prev;
  488.  
  489.     while (p != nullptr) {
  490.         if (p->deg > 0) add_node(dL, p->koef * p->deg, p->deg - 1);
  491.         p = p->prev;
  492.     }
  493.  
  494.     if (n > 1) {
  495.         return derivative(dL, n - 1);
  496.     }
  497.     return dL;
  498. }
  499.  
  500. int check(node* L,int i) {
  501.     node *p = L;
  502.     int sum = 0, x;
  503.     while (p != nullptr) {
  504.         x = 1;
  505.         for (int j = 0; j < p->deg; j++)
  506.             x *= i;
  507.         sum += (x * (int) p->koef);
  508.         p = p->prev;
  509.     }
  510.     return sum;
  511. }
  512.  
  513. void roots(node *L) {
  514.     node *p = L->prev;
  515.     int free, x = 0;
  516.  
  517.     set<int> st;
  518.  
  519.     while (p->prev != nullptr)
  520.         p = p->prev;
  521.     if (p->deg > 0) {
  522.         st.insert(0);
  523.         x = 1;
  524.     }
  525.     free = (int) p->koef;
  526.     for (int i = 1; i * 1.0 <= sqrt(abs(free * 1.0)); i++) {
  527.         if (free % i == 0) {
  528.             if (check(L, i) == 0) {
  529.                 //cout << i << " ";
  530.                 st.insert(i);
  531.                 x = 1;
  532.             }
  533.             if (check(L, -i) == 0) {
  534.                 //cout << -i << " ";
  535.                 st.insert(-i);
  536.                 x = 1;
  537.             }
  538.             if (i * i != free && check(L, free / i) == 0) {
  539.                 //cout << free / i << " ";
  540.                 st.insert(free/i);
  541.                 x = 1;
  542.             }
  543.             if (i * i != free && check(L, -free / i) == 0) {
  544.                 //cout << -free / i << " ";
  545.                 st.insert(-free/i);
  546.                 x = 1;
  547.             }
  548.         }
  549.     }
  550.     if (st.size() == 0) cout << "No roots";
  551.     else {
  552.         cout << "Roots: ";
  553.         for (auto i: st) cout << i << " ";
  554.     }
  555.     cout << endl << endl;
  556. }
  557.  
  558. node* division(node* L1,node* L2,node* L0,node* p0)//L0=p0=NULL
  559. {
  560.     node *L, *head = new node;
  561.     int a;
  562.  
  563.     if (L1!=nullptr&&L1->deg >= L2->deg) {
  564.         a = L1->koef / L2->koef;
  565.         if (L0 == nullptr) {
  566.             ins_after(L1->deg - L2->deg, a, L0, 0);
  567.             p0 = L0;
  568.         } else
  569.             ins_after(L1->deg - L2->deg, a, p0, 1);
  570.  
  571.         if (L1->prev != nullptr) {
  572.             node *p = L1/*->prev*/;
  573.             while (p != nullptr) {
  574.                 add_node(head, p->koef, p->deg);
  575.                 p = p->prev;
  576.             }
  577.             delete p;
  578.         }
  579.  
  580.         if (L2->prev != nullptr) {
  581.             node *p = L2/*->prev*/;
  582.             while (p != nullptr) {
  583.                 add_node(head, -p->koef * a, p->deg + L1->deg - L2->deg);
  584.                 p = p->prev;
  585.             }
  586.             delete p;
  587.         }
  588.         L = head->prev;
  589.  
  590.         division(L, L2, L0, p0);
  591.         return L0;
  592.     } else
  593.         return L0;
  594. }
  595.  
  596. node* multiplication(node* L1,node* L2) {
  597.     node *head = new node;
  598.  
  599.     if (L1->prev != nullptr) {
  600.         node *p = L1->prev;
  601.         while (p != nullptr) {
  602.             node *p1 = L2->prev;
  603.             while (p1 != nullptr) {
  604.                 add_node(head, p->koef * p1->koef, p1->deg + p->deg);
  605.                 p1 = p1->prev;
  606.             }
  607.             delete p1;
  608.             p = p->prev;
  609.         }
  610.         delete p;
  611.     }
  612.  
  613.     return head;
  614. }
  615.  
  616. void add_to_poly(polynomial* &E, node* L)
  617. {
  618.     polynomial* h=new polynomial;
  619.     node* head = new node;
  620.     h->poly=head;
  621.     head->prev=L;
  622.     L->next=head;
  623.     E->next=h;
  624.     E=h;
  625.     h->next= nullptr;
  626. }
  627.  
  628. void print_list(polynomial* HEAD){
  629.     polynomial* h=HEAD->next;
  630.     while(h!=nullptr) {
  631.         print_node(h->poly);
  632.         h = h->next;
  633.     }
  634. }
  635.  
  636. void del_node(node* L) {
  637.     node *p = L, *p1 = L->prev;
  638.     while (p1 != nullptr) {
  639.         delete (p);
  640.         p = p1;
  641.         p1 = p1->prev;
  642.     }
  643.     delete (p);
  644. }
  645.  
  646. bool del_H_node(polynomial* HEAD, polynomial* &END, int n) {
  647.     polynomial *h = HEAD;
  648.     for (int i = 0; i < n - 1 && h != nullptr; i++) {
  649.         h = h->next;
  650.     }
  651.     if (h == nullptr || h->next == nullptr) return 0;
  652.  
  653.     polynomial *d = h->next->next;
  654.     if (h->next == END) {
  655.         END = h;
  656.         del_node(h->next->poly->prev);
  657.     }
  658.  
  659.     h->next = d;
  660.  
  661.     return 1;
  662. }
  663.  
  664.  
  665. polynomial *HEAD = new polynomial, *END = HEAD;
  666.  
  667.  
  668. //#########################
  669.  
  670. void funcs_display(int x) {
  671.     if (x == 5) {
  672.         cout << "Enter number of function: ";
  673.         return ;
  674.     }
  675.     system("cls");
  676.     cout << endl << "LIST:" << endl;
  677.     if (HEAD->next != nullptr) print_list(HEAD);
  678.     cout << endl;
  679.  
  680.     cout << "Functions: " << endl;
  681.     cout << "1: Enter polynomial" << endl;
  682.     cout << "2: Delete polynomial" << endl;
  683.     cout << "3: Integer roots of polynomial" << endl;
  684.     cout << "4: Take the derivative" << endl;
  685.     cout << "5: Summarize polynomial_1 and polynomial_2" << endl;
  686.     cout << "6: Multiply polynomial_1 and polynomial_2" << endl;
  687.     cout << "7: Divide polynomial_1 and polynomial_2" << endl;
  688.     cout << endl;
  689.     //cout << "Enter number of function: ";
  690.     if (x == 1) cout << "Enter number of function: ";
  691.     else if (x == 2) {
  692.         cout << "ERROR IN INPUT" << endl;
  693.         cout << "Enter number of function: ";
  694.     }
  695.     else if (x == 3) {
  696.         cout << "POLYNOMIAL ADDED" << endl;
  697.         cout << "Enter number of function: ";
  698.     }
  699.     else if (x == 4) {
  700.         cout << "POLYNOMIAL DELETED" << endl;
  701.         cout << "Enter number of function: ";
  702.     }
  703. }
  704.  
  705. void start(int flag) {
  706.     funcs_display(flag);
  707.  
  708.     string type;
  709.     getline(cin, type);
  710.     node *head;
  711.  
  712.  
  713.     if (type == "1") {
  714.         int x = 3;
  715.         cout << endl << "Enter polynomial: ";
  716.         string main_str;
  717.         while(getline(cin, main_str)) {
  718.             if (main_str == "") continue;
  719.             head = pol(main_str);
  720.             break;
  721.         }
  722.  
  723.         if (head == nullptr) {
  724.             x = 2;
  725.             cout << "ERROR IN INPUT" << endl;
  726.         }
  727.         else add_to_poly(END, head->prev);
  728.         start(x);
  729.     }
  730.     else if (type == "2") {
  731.         cout << endl << "Enter number of the polynomial: ";
  732.         string NUMV;
  733.         getline(cin, NUMV);
  734.  
  735.         bool YES_NO = del_H_node(HEAD, END, stoi(NUMV));
  736.         if (YES_NO) start(4);
  737.         else start(2);
  738.     }
  739.     else if (type == "3") {
  740.         cout << endl << "Enter number of the polynomial: ";
  741.         string NUMV;
  742.         getline(cin, NUMV);
  743.  
  744.         roots(poly_num(HEAD, stoi(NUMV))->prev);
  745.         start(5);
  746.     }
  747.     else if (type == "4") {
  748.         cout << endl << "Enter number of the polynomial: ";
  749.         string NUMV, ORDER;
  750.         getline(cin, NUMV);
  751.  
  752.         cout << endl << "Enter the order of the derivative: ";
  753.         getline(cin, ORDER);
  754.  
  755.         print_node(derivative(poly_num(HEAD, stoi(NUMV)), stoi(ORDER)));
  756.         //derivative(poly_num(HEAD, stoi(NUMV))->prev, stoi(ORDER));
  757.         start(5);
  758.     }
  759.     else if (type == "5") {
  760.         cout << endl << "Enter numbers of the polynomial_1: ";
  761.         string NUMV1, NUMV2;
  762.         getline(cin, NUMV1);
  763.         cout << "Enter numbers of the polynomial_2: ";
  764.         getline(cin, NUMV2);
  765.  
  766.         print_node(sum(poly_num(HEAD, stoi(NUMV1)), poly_num(HEAD, stoi(NUMV2))));
  767.  
  768.         start(5);
  769.     }
  770.     else if (type == "6") {
  771.         cout << endl << "Enter numbers of the polynomial_1: ";
  772.         string NUMV1, NUMV2;
  773.         getline(cin, NUMV1);
  774.         cout << "Enter numbers of the polynomial_2: ";
  775.         getline(cin, NUMV2);
  776.  
  777.         print_node(multiplication(poly_num(HEAD, stoi(NUMV1)), poly_num(HEAD, stoi(NUMV2))));
  778.         start(5);
  779.     }
  780.     else if (type == "7") {
  781.         cout << endl << "Enter numbers of the polynomial_1: ";
  782.         string NUMV1, NUMV2;
  783.         getline(cin, NUMV1);
  784.         cout << "Enter numbers of the polynomial_2: ";
  785.         getline(cin, NUMV2);
  786.  
  787.         print_node_prev(division( poly_num(HEAD, stoi(NUMV1))->prev, poly_num(HEAD, stoi(NUMV2))->prev, nullptr, nullptr ));
  788.         start(5);
  789.     }
  790.     //start(1);
  791. }
  792.  
  793.  
  794. signed main() {
  795.     start(1);
  796.  
  797.     return 0;
  798. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement