mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
Create COMPLEX_H
Is this where I'm supose yo post
This commit is contained in:
parent
db32c6ccce
commit
fcd54299e7
1 changed files with 42 additions and 0 deletions
42
COMPLEX_H
Normal file
42
COMPLEX_H
Normal file
|
|
@ -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 <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue