-
Notifications
You must be signed in to change notification settings - Fork 0
/
Complex.hpp
46 lines (43 loc) · 1.23 KB
/
Complex.hpp
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
#ifndef COMPLEX_HPP
#define COMPLEX_HPP
#include "utils.hpp"
#include "Rational.hpp"
class Complex : public Symbol
{
public:
class ModuloByNonIntException : public exception
{
virtual const char *what() const throw();
};
class DivisionByZeroException : public exception
{
virtual const char *what() const throw();
};
class NegativePowerException : public exception
{
virtual const char *what() const throw();
};
Complex();
Complex(Rational real, Rational imag);
Complex(Complex const &src);
~Complex();
bool operator==(Complex const &rhs);
Complex &operator=(Complex const &rhs);
Complex operator+(Complex const &rhs);
Complex operator-(Complex const &rhs);
Complex operator*(Complex const &rhs);
Complex operator/(Complex const &rhs);
Complex operator+(Rational const &rhs);
Complex operator-(Rational const &rhs);
Complex operator*(Rational const &rhs);
Complex operator/(Rational const &rhs);
Complex operator^(Number power);
string approximation() const;
Rational getReal() const;
Rational getImag() const;
private:
Rational _real;
Rational _imag;
};
ostream &operator<<(ostream &o, Complex const &rhs);
#endif