資源簡介
純C++代碼,配置環境后可以直接運行,所需要的環境配置方法可以看我的博客前兩篇

代碼片段和文件信息
//
//??Complex.cpp
//??FFT
//
//??Created?by?boone?on?2018/7/17.
//??Copyright???2018年?boone.?All?rights?reserved.
//
#include?“Complex.h“
Complex::Complex()
{
????real?=?0;
????imag?=?0;
}
Complex::Complex(double?re?double?im)
{
????real?=?re;
????imag?=?im;
}
Complex?Complex::operator+(double?v)
{
????return?Complex(real?+?v?imag);
}
Complex?Complex::operator-(double?v)
{
????return?Complex(real?-?v?imag);
}
Complex?Complex::operator*(double?v)
{
????return?Complex(real*v?imag*v);
}
Complex?Complex::operator/(double?v)
{
????return?Complex(real?/?v?imag?/?v);
}
Complex?Complex::operator=(double?v)
{
????real?=?v;
????imag?=?0;
????return?*this;
}
Complex?Complex::operator+=(double?v)
{
????real?+=?v;
????return?*this;
}
Complex?Complex::operator-=(double?v)
{
????real?-=?v;
????return?*this;
}
Complex?Complex::operator*=(double?v)
{
????real?*=?v;
????imag?*=?v;
????return?*this;
}
Complex?Complex::operator/=(double?v)
{
????real?/=?2;
????imag?/=?2;
????return?*this;
}
Complex?Complex::operator+(Complex?c)
{
????return?Complex(real?+?c.real?imag?+?c.imag);
}
Complex?Complex::operator-(Complex?c)
{
????return?Complex(real?-?c.real?imag?-?c.imag);
}
Complex?Complex::operator*(Complex?c)
{
????double?re?=?real*c.real?-?imag*c.imag;
????double?im?=?real*c.imag?+?imag*c.real;
????return?Complex(re?im);
}
Complex?Complex::operator/(Complex?c)
{
????double?x?=?c.real;
????double?y?=?c.imag;
????double?f?=?x*x?+?y*y;
????double?re?=?(real*x?+?imag*y)?/?f;
????double?im?=?(imag*x?-?real*y)?/?f;
????return?Complex(re?im);
}
Complex?Complex::operator=(Complex?c)
{
????real?=?c.real;
????imag?=?c.imag;
????return?*this;
}
Complex?Complex::operator+=(Complex?c)
{
????real?+=?c.real;
????imag?+=?c.imag;
????return?*this;
}
Complex?Complex::operator-=(Complex?c)
{
????real?-=?c.real;
????imag?-=?c.imag;
????return?*this;
}
Complex?Complex::operator*=(Complex?c)
{
????double?re?=?real*c.real?-?imag*c.imag;
????double?im?=?real*c.imag?+?imag*c.real;
????real?=?re;
????imag?=?im;
????return?*this;
}
Complex?Complex::operator/=(Complex?c)
{
????double?x?=?c.real;
????double?y?=?c.imag;
????double?f?=?x*x?+?y*y;
????double?re?=?(real*x?+?imag*y)?/?f;
????double?im?=?(imag*x?-?real*y)?/?f;
????real?=?re;
????imag?=?im;
????return?*this;
}
BOOL?Complex::operator==(Complex?c)
{
????return?((real?==?c.real)?&&?(imag?==?c.imag));
}
BOOL?Complex::operator!=(Complex?c)
{
????return?((real?!=?c.real)?||?(imag?!=?c.imag));
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-07-18?14:16??Spectrum3.0\
?????文件?????????361??2018-07-18?09:17??Spectrum3.0\FFT.h
?????目錄???????????0??2018-07-18?14:23??__MACOSX\
?????目錄???????????0??2018-07-18?14:23??__MACOSX\Spectrum3.0\
?????文件?????????423??2018-07-18?09:17??__MACOSX\Spectrum3.0\._FFT.h
?????文件????????1825??2018-07-18?14:15??Spectrum3.0\FFT.cpp
?????文件?????????176??2018-07-18?14:15??__MACOSX\Spectrum3.0\._FFT.cpp
?????文件????????2478??2018-07-17?20:14??Spectrum3.0\Complex.cpp
?????文件?????????176??2018-07-17?20:14??__MACOSX\Spectrum3.0\._Complex.cpp
?????文件????????3818??2018-07-18?14:16??Spectrum3.0\main.cpp
?????文件?????????333??2018-07-18?14:16??__MACOSX\Spectrum3.0\._main.cpp
?????文件????????1084??2018-07-17?20:14??Spectrum3.0\Complex.h
?????文件?????????266??2018-07-17?20:14??__MACOSX\Spectrum3.0\._Complex.h
- 上一篇:c語言版學生成績管理系統實驗報告
- 下一篇:OpenCV+C++圖像處理項目14個
評論
共有 條評論