-
Notifications
You must be signed in to change notification settings - Fork 0
/
complex.h
42 lines (36 loc) · 826 Bytes
/
complex.h
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
#ifndef complex_h
#define complex_h
struct c
{
double i;
double r;
};
class complex
{
public:
complex();
complex(double i,double r);
~complex();
//accessors
double geti() const;
double getr() const;
//mutators
void seti(double);
void setr(double);
complex operator + (complex);
//c operator + (double);
complex operator - (complex);
//c operator - (double);
complex operator * (complex);
//c operator * (double);
complex operator / (complex);
//c operator / (double);
//c operator ^ (int);//being eble to get its square is enough so I will just use *
//friend c complex::operator + (double lhs,c rhs);
//friend c complex::operator - (double lhs,c rhs);
//friend c complex::operator * (double lhs,c rhs);
//friend c complex::operator / (double lhs,c rhs);
private:
c num;
};
#endif // !complex_h