Frequency Spectrum with c++
You seem to be doing something odd with your frequency axis. This:

t[i]=i*T;
ff[i]=1/t[i];


should probably read:

t[i]=i*T;
ff[i]=Fs*i/N;


The frequency axis you have now is nonlinear. The FFT generally generates linearly spaced frequency samples.