-
Notifications
You must be signed in to change notification settings - Fork 0
/
complexType.h
52 lines (38 loc) · 2.34 KB
/
complexType.h
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
47
48
49
50
51
52
//
// Created by samlexxy on 06/04/2020.
//
#ifndef PROJECT6_COMPLEXTYPE_H
#define PROJECT6_COMPLEXTYPE_H
#include <iostream>
using namespace std;
class complexType //CLASS TO INPUT AND PRINT A COMPLEX NUMBER IN IT ORIGINAL FORMAT
{
friend ostream& operator<<(ostream& ,const complexType&); // overloaded stream extraction / output operator
friend istream& operator>>(istream& , complexType&); // overloaded stream insertion / input operator
public:
double getRealNumber() const; // function that returns the Real Number
double getImaginaryNumber() const; // function that returns the Imaginary Number
void setRealNumber(double realNum); // function that accepts and stores the Real Number
void setImaginaryNumber(double imagNum); // function that accepts and stores the Imaginary Number
complexType operator+(const complexType&) const; // overloaded addition operator
complexType operator*(const complexType&) const; // overloaded multiplication operator
complexType operator-(const complexType&) const; // overloaded subtraction operator
complexType operator/(const complexType&) const; // overloaded division operator
bool operator==(const complexType&) const; // overloaded equalTo operator
bool operator!=(const complexType&) const; // overloaded not equalTo operator
bool operator<=(const complexType&) const; // overloaded less than or equalTo operator
bool operator<(const complexType&) const; // overloaded less than operator
bool operator>=(const complexType&) const; // overloaded greater than or equalTo operator
bool operator>(const complexType&) const; // overloaded greater than operator
complexType operator++(); // overloaded pre-increment operator
complexType operator++(int); // overloaded post-increment operator
complexType operator--(); // overloaded pre-decrement operator
complexType operator--(int); // overloaded post-decrement operator
const complexType& operator=(const complexType&); // overloaded assignment operator
complexType(double realNum = 1, double imaginaryNum = 1); // the default constructor with a parameters
complexType(const complexType&); // the copy constructor
private:
double realNumber; // variable that stores the Real Number
double imaginaryNumber; // variable that stores the Imaginary Number
};
#endif //PROJECT6_COMPLEXTYPE_H