-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplexnumber.h
More file actions
26 lines (22 loc) · 815 Bytes
/
complexnumber.h
File metadata and controls
26 lines (22 loc) · 815 Bytes
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
#ifndef COMPLEXNUMBER_H
#define COMPLEXNUMBER_H
#include "evaluatable.h"
#include "stack.h"
class ComplexNumber : public Evaluatable {
public:
ComplexNumber() = default;
ComplexNumber(double real_, double imaginary_ = 0.0);
double real() const;
double imaginary() const;
double abs() const;
void evaluate(Stack<ComplexNumber>& operands_) const override;
ComplexNumber operator+(const ComplexNumber& other_) const;
ComplexNumber operator-(const ComplexNumber& other_) const;
ComplexNumber operator*(const ComplexNumber& other_) const;
ComplexNumber operator/(const ComplexNumber& other_) const;
private:
double m_real{0.0};
double m_imaginary{0.0};
};
std::ostream& operator<<(std::ostream& stream_, const ComplexNumber& complexNumber_);
#endif // COMPLEXNUMBER_H