24 lines
474 B
C
24 lines
474 B
C
|
#ifndef COMPLEX_H
|
||
|
#define COMPLEX_H
|
||
|
|
||
|
class complex {
|
||
|
public:
|
||
|
double re, im;
|
||
|
public:
|
||
|
complex (const double x=0.0, const double y=0.0);
|
||
|
complex & operator*= (const double a) {
|
||
|
re *= a; im *= a;
|
||
|
return * this;
|
||
|
}
|
||
|
complex & operator+= (const complex & a) {
|
||
|
re += a.re; im += a.im;
|
||
|
return * this;
|
||
|
}
|
||
|
complex & exp (const unsigned n);
|
||
|
double abs () const {
|
||
|
return re * re + im * im;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif // COMPLEX_H
|