📄 complex.cpp
字号:
// complex.cpp: implementation of the complex class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "sun.h"
#include "complex.h"
#include<math.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
complex operator+(const complex & c1,const complex & c2){
return complex(c1.Real+c2.Real,c1.Image+c2.Image);
}
complex operator-(const complex & c1,const complex & c2){
return complex(c1.Real-c2.Real,c1.Image-c2.Image);
}
complex operator*(const complex & c1,const complex & c2){
return complex(c1.Real*c2.Real-c1.Image*c2.Image,c1.Real*c2.Image+c2.Real*c1.Image);
}
void complex:: operator=(const complex & c){
Real=c.Real;
Image=c.Image;
}
double complex::arg(){
return(atan(Image/Real));
}
double complex::abs()
{
return sqrt(Real*Real+Image*Image);
}
double complex::ShowReal()
{return Real;
}
void complex::daon(int n)
{ Real=Real/n;
Image=Image/n;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -