?? complex.h
字號:
#if !defined _COMPLEX_H_
#define _COMPLEX_H__
#include <math.h>
class CComplex //類聲明
{public:
CComplex(); //基本構造函數
CComplex(double dblX, double dblY); //指定值構造函數
CComplex(const CComplex& other); //拷貝構造函數
virtual ~CComplex() {}; //析構函數
void SetReal(double dblX); //指定復數的實部
void SetImag(double dblY); //指定復數的虛部
double GetReal(); //取復數的實部
double GetImag(); //取復數的虛部
CString ToString() const; //將復數轉化為"a+bj"形式的字符串
//將"a,b"形式的字符串對轉化為復數,以a為復數的實部,b為復數的虛部
void FromString(CString s, const CString& sDelim = " ");
BOOL operator==(const CComplex& cpxX) const;
BOOL operator!=(const CComplex& cpxX) const;
CComplex& operator=(const CComplex& cpxX);
CComplex operator+(const CComplex& cpxX) const;
CComplex operator-(const CComplex& cpxX) const;
CComplex operator*(const CComplex& cpxX) const;
CComplex operator/(const CComplex& cpxX) const;
protected:
double m_dblX; //復數的實部
double m_dblY; //復數的虛部
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -