-
Notifications
You must be signed in to change notification settings - Fork 0
/
_pol.cpp
57 lines (56 loc) · 1.27 KB
/
_pol.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "C:\mylib\polynomial.lib"
signed main() {
std::string s, t;
std::cout << "do you need only coefficients?\nchoose 'yes' or 'no'\n";
std::cin >> t;
while (t != "yes" && t != "no") {
std::cout << "wrong input\n";
std::cin >> t;
}
std::cout << "available operations:\nval\n+\n-\n*\ngcd\nexit\n";
while (true) {
std::cin >> s;
if (s == "val") {
polynomial <long long> a;
std::string q;
std::getline(std::cin, q);
std::cin >> a;
long long x;
std::cin >> x;
std::cout << a.val(x) << '\n';
}
if (s == "+") {
polynomial <long long> a, b;
std::string q;
std::getline(std::cin, q);
std::cin >> a >> b;
(a + b).print(t);
}
if (s == "-") {
polynomial <long long> a, b;
std::string q;
std::getline(std::cin, q);
std::cin >> a >> b;
(a - b).print(t);
}
if (s == "*") {
polynomial <long long> a, b;
std::string q;
std::getline(std::cin, q);
std::cin >> a >> b;
(a * b).print(t);
}
if (s == "gcd") {
std::cout << "sorry, this action is temporarily unavailable\n";
/*
polynomial <long long> a, b;
std::string q;
std::getline(std::cin, q);
std::cin >> a >> b;
(gcd(a, b)).print("");
*/
}
if (s == "exit")
return 0;
}
}