-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
32 lines (26 loc) · 939 Bytes
/
main.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
#include <iostream>
#include "complex.h"
using namespace std;
int main() {
complex c0; // complex()
complex c1(3, 4); // complex(double, double)
complex c2(c1); // complex(complex&)
cout << c1 << endl; // operator<<()
cout << c2.abs() << endl; // abs()
cout << c1.complement() << endl; // complement()
cout << -c2 << endl; // operator+(complex)
cout << c1 + c2 << endl; // operator+(complex)
cout << c1 + c2 << endl; // operator+(complex)
cout << c1 - c2 << endl; // operator-(complex)
cout << c1 * c2 << endl; // operator*(complex)
cout << c1 / c2 << endl; // operator/(complex)
c1 += 4; // operator +=(double)
cout << c1 << endl;
cout << c1.real() << endl; // real()
cout << c1.imaginary() << endl; // imaginary()
complex c3;
cin >> c3; // operator>>()
complex c4 = 4 - c3; // operator-(double, complex)
cout << c4 << endl;
return 0;
}