#include"C:\Users\hp\Desktop\complex.h"
main()
{
complex *a;
int N=1024;
//给a赋值
fft(a,N)
}
int fft(complex *a,int l)
{
const double pai=3.141592653589793;
complex u,w,t;
unsigned n=1,nv2,nm1,k,le,lei,ip;
unsigned i,j,m;
double tmp;
x<<=1;
nv2=n>>1;
nm1=n-1;
i=0;
for(i=0;i<nm1;i++)
{
if(i<j)
{
t=a[j]
a[j]=a[i];
a[i]=t;
}
k=nv2;
while(k<=j)
{
j-=k;
k>>=1
}
j+=k
}
le=1
for(m=1;m<=1;m++)
{
lei=le
le<<=1;
u=conplex(1,0);
tmp=pai/lei;
w=complex(cos(tmp),-sin(tmp);
for(j=0;j<lei;j++)
{
for(i=j;i<n;i+=le)
{
for(i=j;i<n;i+=le)
{
ip=i+lei;
t=a[ip]*u;
a[ip]=a[i]-t;
a[i]+=t;
}
u*=w;
}
}
return o;
}