-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestComplex.cpp
More file actions
42 lines (41 loc) · 1.41 KB
/
Copy pathTestComplex.cpp
File metadata and controls
42 lines (41 loc) · 1.41 KB
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
#include <iostream>
#include <numbers>
#include "libcomplex/Complex.hpp"
int main()
{
using std::cout;
using std::endl;
using std::cin;
cout << "Program testujący liczby zespolone.\n";
Complex z1, z2, z3;
z3.setMode(Complex::POL);
long double d;
cout << "Podaj pierwszą liczbę z1.\n";
cin >> z1;
cout << "Podaj drugą liczbę z2.\n";
cin >> z2;
cout << "Podaj trzecią liczbę z3.\n";
cin >> z3;
cout << "Podaj liczbę rzeczywistą d.\n";
cin >> d;
cout << "Re(z1) = " << z1.Re() << endl;
cout << "Im(z1) = " << z1.Im() << endl;
cout << "|z1| = " << z1.Abs() << endl;
cout << "Arg(z1) = " << z1.Arg() << endl;
cout << "z1 + z2 = " << z1 + z2 << endl;
cout << "z1 - z2 = " << z1 - z2 << endl;
cout << "z1 * z2 = " << z1 * z2 << endl;
cout << "z1 / z2 = " << z1 / z2 << endl;
cout << "z3 = " << z3 << endl;
z3 *= (z1 + z2);
cout << "z3 po modyfikacji (z3 *= z1 + z2): " << z3 << endl;
z3.setMode(Complex::RECT);
cout << "Czyli " << z3 << endl;
cout << "z1^7 = " << Power(z1, 7) << endl;
cout << "z1^(-7) = " << Power(z1, -7) << endl;
cout << "Pierwszy pierwiastek 7 stopnia z z1 = " << Root(z1, 7, 0) << endl;
cout << "Drugi pierwiastek 7 stopnia z z1 = " << Root(z1, 7, 1) << endl;
cout << "e^z1 = " << Exp(std::numbers::e_v<long double>, z1) << endl;
cout << "7^z1 = " << Exp(7, z1) << endl;
return 0;
}