From fcd54299e7257fc1e6e71e99b4f2c25939744515 Mon Sep 17 00:00:00 2001 From: henryannan631 Date: Wed, 5 Feb 2025 10:41:53 -0600 Subject: [PATCH] Create COMPLEX_H Is this where I'm supose yo post --- COMPLEX_H | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 COMPLEX_H diff --git a/COMPLEX_H b/COMPLEX_H new file mode 100644 index 000000000..7bed1d301 --- /dev/null +++ b/COMPLEX_H @@ -0,0 +1,42 @@ +// henry tawiah annan +// H00878886 +// CSC 122 - B01 +// +// I certify that this is my own work and where appropriate an extension +// of the starter code provided for the assignment. +// *************************************************************************** + +#ifndef COMPLEX_H +#define COMPLEX_H + +#include +#include + +class Complex { +private: + double real; + double imag; +public: + Complex(); + Complex(double r, double i); + + double getReal() const; + double getImag() const; + + void setReal(double r); + void setImag(double i); + + Complex operator+(const Complex& other) const; + Complex operator-(const Complex& other) const; + Complex operator*(const Complex& other) const; + Complex operator/(const Complex& other) const; + Complex operator-() const; + + double magnitude() const; + Complex conjugate() const; + + friend std::ostream& operator<<(std::ostream& os, const Complex& c); + friend std::istream& operator>>(std::istream& is, Complex& c); +}; + +#endif