root@ubuntu:/home/cpptest# g++ -w -D USE_STL -o complex complex.cpp
root@ubuntu:/home/cpptest# ./complex
a+b = (5,7)
a-b = (-3,-3)
a*b = (-6,13)
a/b = (0.341463,0.0731707)
log(3,2)= (1.28247,0.588003)
sin(1,2.1)= (3.48732,2.17302)
cos(1,2.1)= (2.23918,-3.38428)
exp(1,2.1)= -1.37231+2.34645i
norm(1,2.1)= 5.41
arg(1,2.1)= 1.12638
conj(1,2.1)= (1,-2.1)
abs(1,2.1)= 2.32594
tan(1,2.1)= 0.0276093+1.01218i
tan(1,2.1)= (0.0276093,1.01218)
atan(0.0276093,1.01218)= (1,2.1)
y = (2,2.1)
i=(0,1)
a=(-1,0)
b=(0,-1)
z=(5,7)
w=sin(z)=(-525.795,155.537)
z=(0.75,0.25)
w=cos(z)=(0.754673,-0.17219)
z=(0.25,0.25)
w=tan(z)=(0.23909,0.259871)
p=conj(i)=(0,-1)
q=real(i)=(0,0)
r=imag(i)=(1,0)
z=(3,2)
w=ln(z)=(1.28247,0.588003)
z=(55.6,68.2)
zabs=abs(z)=87.992
z=(16,81)
r1=4
w=z^r1=(3.30346e+07,-3.26851e+07)
c=sqrt(i)=(0.707107,0.707107)
d=sin(i)=(0,1.1752)
e=i^0.25=(0.92388,0.382683)
z=(1,1)
z1=(1,1)
w=z^z1=(0.273957,0.583701)
root@ubuntu:/home/cpptest# g++ -w -o complex complex.cpp
root@ubuntu:/home/cpptest# ./complex
a+b = (5,7)
a-b = (-3,-3)
a*b = (-6,13)
a/b = (0.341463,0.0731707)
log(3,2)= (1.28247,0.588003)
sin(1,2.1)= (3.48732,2.17302)
cos(1,2.1)= (2.23918,-3.38428)
exp(1,2.1)= -1.37231+2.34645i
norm(1,2.1)= 5.41
arg(1,2.1)= 1.12638
conj(1,2.1)= (1,-2.1)
abs(1,2.1)= 2.32594
tan(1,2.1)= 0.0276093+1.01218i
tan(1,2.1)= (0.0276093,1.01218)
atan(0.0276093,1.01218)= (1,2.1)
y = (2,2.1)
i=(0,1)
a=(-1,0)
b=(0,-1)
z=(5,7)
w=sin(z)=(-525.795,155.537)
z=(0.75,0.25)
w=cos(z)=(0.754673,-0.17219)
z=(0.25,0.25)
w=tan(z)=(0.23909,0.259871)
p=conj(i)=(0,-1)
q=real(i)=(0,0)
r=imag(i)=(1,0)
z=(3,2)
w=ln(z)=(1.28247,0.588003)
z=(55.6,68.2)
zabs=abs(z)=87.992
z=(16,81)
r1=4
w=z^r1=(3.30346e+07,-3.26851e+07)
c=sqrt(i)=(0.707107,0.707107)
d=sin(i)=(0,1.1752)
e=i^0.25=(0.92388,0.382683)
z=(1,1)
z1=(1,1)
w=z^z1=(0.273957,0.583701)
#ifdef USE_STL
#include <complex>
#else
#endif
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
#ifndef USE_STL
// 模板类友元函数的前置声明,<>的作用是告诉编译器不是普通函数的声明,是友元函数的声明
template<class T> class complex;
template<class T> ostream& operator<<(ostream& os,const complex<T>& c);
//template<class T> complex<T> operator/(complex<T> &, T);
template<class T> complex<T> div(T r, complex<T> & b);
template<class T> complex<T> cos(complex<T> &);
template<class T> complex<T> sin(complex<T> &);
template<class T> T real(complex<T> &); // the real part
template<class T> T imag(complex<T> &); // the imaginary part
template<class T> complex<T> conj(complex<T> &); // the complex conjugate
template<class T> T abs(complex<T> &); //求模
template<class T> complex<T> log(complex<T> &);
template<class T> complex<T> tan(complex<T> &);
template<class T> complex<T> exp(complex<T> &);
template<class T> complex<T> pow(complex<T> & __base, T __expon);
template<class T> complex<T> pow(complex<T> & cpxz,complex<T> & cpxn,int n);
template<class T> complex<T> pow(complex<T> & cpxz,complex<T> & cpxn);
template<class T> T norm(complex<T> &); // the square of the magnitude
template<class T> T arg(complex<T> &); // the angle in the plane
template<class T> complex<T