跟着Bin哥一起学。
#include#include #include #include #include using namespace std; const double PI=acos(-1.0); struct Complex { double x,y; Complex(double _x=0.0,double _y=0.0) { x=_x; y=_y; } Complex operator -(const Complex &b)const { return Complex(x-b.x,y-b.y); } Complex operator +(const Complex &b)const { return Complex(x+b.x,y+b.y); } Complex operator *(const Complex &b)const { return Complex(x*b.x-y*b.y,x*b.y+y*b.x); } }; void change(Complex y[],int len) { int i,j,k; for(i=1,j=len/2;i =k) { j-=k; k/=2; } if(j 0) len--; for(int i=len;i>=0;i--) printf("%c",sum[i]+'0'); printf("\n"); } return 0; }