📄 complextype.h
字号:
//Specification file complexType.h
#ifndef H_complexNumber
#define H_complexNumber
#include <iostream>
using namespace std;
class complexType
{
//Overload the stream insertion and extraction operators
friend ostream& operator<< (ostream&, const complexType&);
friend istream& operator>> (istream&, complexType&);
public:
void setComplex(const double& real, const double& imag);
//Function to set the complex numbers according to
//the parameters.
//Postcondition: realPart = real; imaginaryPart = imag
complexType(double real = 0, double imag = 0);
//constructor
//Initializes the complex numbers according to
//the parameters.
//Postcondition: realPart = real; imaginaryPart = imag
complexType operator+(const complexType& otherComplex) const;
//Overload the operator +
complexType operator*(const complexType& otherComplex) const;
//Overload the operator *
bool operator==(const complexType& otherComplex) const;
//Overload the operator ==
private:
double realPart; //variable to store the real part
double imaginaryPart; //variable to store the imaginary part
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -