How to implement the imaginary part of FFT equation applied to a signal in computer/C++? I am trying to apply FFT on a time domain signal in C++, however I am having trouble with the imaginary part i.e square root of -1. In the FFT equation we have, 

$$X =\frac{1}{2\pi}\int_a^b x(t) \ e^{-j\omega t} \ dt$$ 

we know that:
$$
e^{-j\omega t} = \cos(\omega t) - j\sin(\omega t) \tag{2}
$$

we also know that:

$$ \ j = \sqrt{-1}\ $$

Problem :  I am trying to apply the fft equation on a signal and the problem of implementation arises when coding the equation(2) in C++. As, we know the value of $ \ j = \sqrt{-1}\ $ is infinite or if tried to solve using a calculator, we get a Math Error*. And so is my program giving an error and I'd like to get suggestions and advises on how to solve this issue and apply the FFT equation in C++.
In computer programs, complex numbers are usually represented by an array, field or vector containing two values: one value represents the real part, the other represents the imaginary part of the complex number. The imaginary unit itself is usually not represented at all, because this information would be redundant.

An alternative representation is to store the magnitude and phase angle of a complex number.

Specifically in C++, there is the class complex&lt;T&gt; from the STL library that takes care of storing two values of type T for every complex value. You should use that, it's part of the standard libraries.